예제 #1
0
string
mangleTemplateToString (const string& templ_name,
                        const SgTemplateArgumentPtrList& templ_args,
                        const SgScopeStatement* scope)
   {
  // Mangle all the template arguments
     string args_mangled;
  // if (templ_args.begin() != templ_args.end())
     if (templ_args.empty() == true)
        {
          args_mangled = "unknown_arg";
        }
       else
        {
          args_mangled = mangleTemplateArgsToString(templ_args.begin(),templ_args.end());
        }

  // Compute the name qualification, if any.
     string scope_name;
     if (scope == NULL)
        {
          scope_name = "unknown_scope";
        }
       else
        {
          scope_name = mangleQualifiersToString (scope);
        }

  // Compute the final mangled name.
     string mangled_name = joinMangledQualifiersToString (scope_name, templ_name);
  // printf ("joinMangledQualifiersToString (scope_name, templ_name) : mangled_name = %s \n",mangled_name.c_str());

     if (mangled_name.empty() == true)
        {
          mangled_name = "unknown_template_name";
        }

     mangled_name += "__tas__" + args_mangled + "__tae__";

  // printf ("args_mangled = %s mangled_name = %s \n",args_mangled.c_str(),mangled_name.c_str());

     return mangled_name;
   }
예제 #2
0
bool FixupTemplateArguments::contains_private_type ( SgTemplateArgumentPtrList & templateArgList, SgScopeStatement* targetScope )
   {
     bool returnValue = false;

  // ROSE_ASSERT(templateArgList.empty() == false);

     static std::set<SgTemplateArgumentPtrList> templateArgumentListSet;

  // DQ (2/15/2017): Make a copy of the vector and use that as a basis for identifing if the list has been previously processed.
  // SgTemplateArgumentPtrList templateArgList = templateArgList;
  // ROSE_ASSERT(templateArgList.empty() == false);

     if (templateArgumentListSet.find(templateArgList) == templateArgumentListSet.end())
        {
          templateArgumentListSet.insert(templateArgList);
        }
       else
        {
// #if DEBUGGING_USING_RECURSIVE_DEPTH
#if 0
          printf ("################# Already been or being processed: templateArgumentListSet.size() = %zu \n",templateArgumentListSet.size());
#endif

#if 0
          printf ("Leaving contains_private_type(SgTemplateArgumentPtrList): templateArgumentListSet.size() = %zu returning FALSE \n",templateArgumentListSet.size());
#endif
       // DQ (2/15/2017): Unclear if this is the correct return value, it might be that we want to record 
       // the associated value from the first time the argument list was processed and use that value.
       // Then again, if the value had already been substituted into the template argument then no further 
       // processing is required.
          return false;
        }

     int counter = 0;
     SgTemplateArgumentPtrList::const_iterator i = templateArgList.begin();
     while (returnValue == false && i != templateArgList.end())
        {
#if 0
#if DEBUGGING_USING_RECURSIVE_DEPTH
          printf ("In contains_private_type(SgTemplateArgumentPtrList): global_depth = %zu Evaluating template argument # %d = %p = %s \n",
               global_depth,counter,*i,(*i)->class_name().c_str());
#else
          printf ("In contains_private_type(SgTemplateArgumentPtrList): Evaluating template argument # %d = %p = %s \n",counter,*i,(*i)->class_name().c_str());
#endif
#endif
          returnValue |= contains_private_type(*i,targetScope);
#if 0
#if DEBUGGING_USING_RECURSIVE_DEPTH
          printf ("In contains_private_type(SgTemplateArgumentPtrList): global_depth = %zu template argument # %d = %p = %s returnValue = %s \n",
               global_depth,counter,*i,(*i)->class_name().c_str(),returnValue ? "true" : "false");
#else
          printf ("In contains_private_type(SgTemplateArgumentPtrList): template argument # %d = %p = %s returnValue = %s \n",
               counter,*i,(*i)->class_name().c_str(),returnValue ? "true" : "false");
#endif
#endif
          i++;
          counter++;
        }

#if DEBUG_PRIVATE_TYPE || 0
     printf ("Leaving contains_private_type(SgTemplateArgumentPtrList): templateArgumentListSet.size() = %zu returnValue = %s \n",templateArgumentListSet.size(),returnValue ? "true" : "false");
#endif

     return returnValue;
   }