当前位置: 首页>>代码示例>>C++>>正文


C++ SgName类代码示例

本文整理汇总了C++中SgName的典型用法代码示例。如果您正苦于以下问题:C++ SgName类的具体用法?C++ SgName怎么用?C++ SgName使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SgName类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ROSE_ASSERT

NodeQuerySynthesizedAttributeType NodeQuery::queryNodeClassDeclarationFromName(SgNode* node, SgNode* nameNode){
  NodeQuerySynthesizedAttributeType returnList;
  ROSE_ASSERT( nameNode != NULL );
  ROSE_ASSERT( node     != NULL );


  //finds the name which should be matched to 
  SgName* sageName = isSgName(nameNode);
  ROSE_ASSERT( sageName != NULL );
  std::string nameToMatch = sageName->str();
  ROSE_ASSERT( nameToMatch.length() > 0 );

  SgClassDeclaration *sageClassDeclaration = isSgClassDeclaration (node);

  if (sageClassDeclaration != NULL)
  {

    std::string name = sageClassDeclaration->get_name ().str ();

    if( name == nameToMatch )
      returnList.push_back(node);

  }

  return returnList;

} /* End function:queryNodeCLassDeclarationFromName() */
开发者ID:LindaLovelace,项目名称:rose,代码行数:27,代码来源:nodeQuery.C

示例2: isSgFunctionRefExp

void visitorTraversal::analyzePath(vector<VertexID>& pth) {
    std::vector<VertexID> pathR = pth;
    std::vector<SgGraphNode*> path;
    for (unsigned int j = 0; j < pathR.size(); j++) {
        SgGraphNode* R = (*orig)[pathR[j]].sg;
        path.push_back(R);
    }
    for (unsigned int k = 0; k < path.size(); k++) {
        if (isSgFunctionRefExp(path[k]->get_SgNode())) {
            SgFunctionRefExp* sfrd = isSgFunctionRefExp(path[k]->get_SgNode());
            SgFunctionDeclaration* fd = sfrd->getAssociatedFunctionDeclaration();
            fd = isSgFunctionDeclaration(fd->get_definingDeclaration());
            assert(fd!=NULL);
            SgFunctionDefinition* fdd = fd->get_definition();
            SgName sname = fdd->get_mangled_name();
            string sn = sname.getString();
            if (find(defstr.begin(), defstr.end(), sn) == defstr.end()) {
                defstr.push_back(sn);
                defs.push_back(fdd);
                std::cout << "found new sn: " << sn << std::endl;
            }
            else {
                std::cout << "found old sn: " << sn << std::endl;
            }
        }
    }
#pragma omp atomic
    paths++;
}
开发者ID:billhoffman,项目名称:rose-develop,代码行数:29,代码来源:proFunSIG.C

示例3: mangleFunctionName

SgName
mangleFunctionName (const SgName& n, const SgName& ret_type_name )
  {
    string s_mangled = mangleFunctionNameToString (n.getString (),
                                                   ret_type_name.str ());
    SgName n_mangled (s_mangled.c_str ());
    return n_mangled;
  }
开发者ID:InstRO,项目名称:InstRO-ROSE-Develop,代码行数:8,代码来源:manglingSupport.C

示例4: isSgSourceFile

ScopExtractor::ScopExtractor(SgProject* project, PolyRoseOptions& polyopts)
{
  //   this->project = project;
  this->polyoptions = polyopts;
  isVerbose = ! polyopts.getQuiet();
  if (isVerbose)
    std::cout << "[PolyOpt] Using generic scop extractor" << std::endl;

  SgFilePtrList& file_list = project->get_fileList();
  SgFilePtrList::const_iterator file_iter;
  // Iterate on all files of the project.
  for (file_iter = file_list.begin(); file_iter != file_list.end(); file_iter++)
    {
      SgSourceFile* file = isSgSourceFile(*file_iter);
      if (polyoptions.getScVerboseLevel())
	cout << "[Extr] File: " << file->getFileName() << endl;
      SgNodePtrList funcDefnList =
	NodeQuery::querySubTree(file, V_SgFunctionDefinition);
      SgNodePtrList::const_iterator iter;
      // Iterate on all function defined in a file.
      for (iter = funcDefnList.begin(); iter != funcDefnList.end(); ++iter)
	{
	  SgFunctionDefinition *fun = isSgFunctionDefinition(*iter);
	  if (!fun)
	    {
	      cout << "[Extr] Warning: Expected SgFunctionDefinition in " <<
		file->getFileName() << endl;
	      continue; // with the next function definition
	    }
	  SgName name = fun->get_declaration()->get_name();
	  if (polyoptions.getScVerboseLevel())
	    cout << "[Extr] Function: " << name.getString() << endl;
	  SgBasicBlock* body = fun->get_body();

	  // Ensure the function is a candidate (no (unsafe) function
	  // calls).
	  if (assertFunctionIsCandidate(project, body))
	    {
	      // Proceed recursively, bottom up.
	      inspectBottomUpFunctionBody(project, body);
	    }
	}
    }
  if (isVerbose)
    std::cout << "[ScopExtraction] Generic: done" << std::endl;
}
开发者ID:8l,项目名称:rose,代码行数:46,代码来源:ScopExtractor.cpp

示例5: DCL01_C

/**
 * Do not reuse variable names in subscopes
 */
bool DCL01_C( const SgNode *node ) {
	const SgInitializedName *varInitName = isSgInitializedName(node);
	if (!varInitName)
		return false;
	const SgName varName = varInitName->get_name();
	const SgScopeStatement *varScope = varInitName->get_scope();
	assert(varScope);
	while(!isSgGlobal(varScope)) {
		varScope = varScope->get_scope();
		if(varScope->symbol_exists(varName)) {
			print_error(node, "DCL01-C", ("Do not reuse variable names in subscopes: " + varName.getString()).c_str(), true);
			return true;
		}
	}

	return false;
}
开发者ID:8l,项目名称:rose,代码行数:20,代码来源:DCL.C

示例6: mangleTemplate

SgName
mangleTemplate (const SgName& templ_name,
                const SgTemplateArgumentPtrList& templ_args,
                const SgScopeStatement* scope)
   {
     string mangled_name = mangleTemplateToString(templ_name.getString(),templ_args,scope);
  // printf ("In mangleTemplate(): mangled_name = %s \n",mangled_name.c_str());
     return SgName (mangled_name.c_str());
   }
开发者ID:InstRO,项目名称:InstRO-ROSE-Develop,代码行数:9,代码来源:manglingSupport.C

示例7: isSgVariableDeclaration

void
Unparse_Jovial::unparseVarDecl(SgStatement* stmt, SgInitializedName* initializedName, SgUnparse_Info& info)
   {
     SgName name         = initializedName->get_name();
     SgType* type        = initializedName->get_type();
     SgInitializer* init = initializedName->get_initializer();
     ROSE_ASSERT(type);

     SgVariableDeclaration* variableDeclaration = isSgVariableDeclaration(stmt);
     ROSE_ASSERT(variableDeclaration != NULL);

#if 0
     if (variableDeclaration->get_declarationModifier().get_typeModifier().isStatic() == true)
        {
           curprint("STATIC ");
        }
#endif

     switch (type->variantT())
        {
          case V_SgArrayType:
             curprint("TABLE ");
             curprint(name.str());
             break;
          default:
             curprint("ITEM ");
             curprint(name.str());
             curprint(" ");
        }

     unparseType(type, info);

     if (init != NULL)
        {
           curprint(" = ");
           SgInitializer* initializer = isSgInitializer(init);
           ROSE_ASSERT(initializer != NULL);
           // TODO
           // unparseExpression(initializer, info);
        }

     curprint(" ;\n");
   }
开发者ID:matzke1,项目名称:rose-develop,代码行数:43,代码来源:unparseJovial_statements.C

示例8: queryNodeClassDeclarationFromTypedefName

NodeQuerySynthesizedAttributeType
queryNodeClassDeclarationFromTypedefName (SgNode * astNode,
							   SgNode * nameNode)
{
  NodeQuerySynthesizedAttributeType returnList;
  ROSE_ASSERT (nameNode != NULL);
  ROSE_ASSERT (nameNode != NULL);


  //finds the name which should be matched to 
  SgName *sageName = isSgName (nameNode);
  ROSE_ASSERT (sageName != NULL);
  string nameToMatch = sageName->str ();
  ROSE_ASSERT (nameToMatch.length () > 0);

  if (isSgType (astNode) != NULL)
    {
      /*SgTypedefType* sageTypedefType = isSgTypedefType(astNode);
         string name = TransformationSupport::getTypeName(sageTypedefType);
         ROSE_ASSERT( nameToMatch.length() > 0 );
         cout << nameToMatch << endl; */
#ifdef DEBUG_CGRAPHPP
      cout << TransformationSupport::getTypeName (isSgType (astNode)) << endl;
#endif
      if (TransformationSupport::getTypeName (isSgType (astNode)) ==
	  nameToMatch)
	{
	  returnList.push_back (astNode);
	}
/*
	  if(nameToMatch == name){
		  SgClassDeclaration *sageClassDeclaration = isSgClassDeclaration (sageTypedefType->get_declaration());
		  ROSE_ASSERT( sageClassDeclaration != NULL );
		  returnList.push_back(sageClassDeclaration);
	  }*/
    }


  return returnList;



}
开发者ID:8l,项目名称:rose,代码行数:43,代码来源:helpFunctions.C

示例9: isSgFunctionDefinition

/**
 * Create scops for a sub-tree.
 *
 */
void
ScopExtractor::extractScops(SgNode* root)
{
  if (isVerbose)
    std::cout << "[PolyOpt] Using generic scop extractor" << std::endl;

  SgNodePtrList funcDefnList =
    NodeQuery::querySubTree(root, V_SgFunctionDefinition);
  SgNodePtrList::const_iterator iter;
  // Iterate on all functions defined in a sub-tree.
  for (iter = funcDefnList.begin(); iter != funcDefnList.end(); ++iter)
    {
      SgFunctionDefinition *fun = isSgFunctionDefinition(*iter);
      if (!fun)
	{
	  cout << "[Extr] Warning: Expected SgFunctionDefinition" << endl;
	  continue; // with the next function definition
	}
      SgName name = fun->get_declaration()->get_name();
      if (polyoptions.getScVerboseLevel())
	cout << "[Extr] Function: " << name.getString() << endl;
      SgBasicBlock* body = fun->get_body();

      // Ensure the function is a candidate (no (unsafe) function
      // calls).
      if (assertFunctionIsCandidate(NULL, body))
	{
	  // Proceed recursively, bottom up.
	  inspectBottomUpFunctionBody(NULL, body);
	}
    }

  // If no function is defined in the subtree, simply process it
  // as-is.
  if (funcDefnList.size() == 0)
    if (assertFunctionIsCandidate(NULL, root))
      // Proceed recursively, bottom up.
      inspectBottomUpFunctionBody(NULL, root);

  if (isVerbose)
    std::cout << "[ScopExtraction] Generic: done" << std::endl;
}
开发者ID:8l,项目名称:rose,代码行数:46,代码来源:ScopExtractor.cpp

示例10: isSgFunctionDeclaration

void
SimpleInstrumentation::visit ( SgNode* astNode )
   {
  // Demonstrate and test append mechanism for statements

  // printf ("In assemblyFunction(): astNode->sage_class_name() = %s \n",astNode->sage_class_name());

     if (isSgFunctionDeclaration(astNode) != NULL)
        {
       // printf ("Found a function declaration \n");
          SgFunctionDeclaration* functionDeclarationStatement = isSgFunctionDeclaration(astNode);
          SgName sageName = functionDeclarationStatement->get_name();
          string functionNameString = sageName.str();

       // Make sure this is the "main" function before we insert new code
          if (functionNameString == "main")
             {
               string globalDeclarations = "int k;";
               string functionSource = "";
	       string localDeclarations = "\
void myTimerFunctionStart(void) \n\
   { \n\
     int xyzVariable; \n\
   } \n\n\
开发者ID:8l,项目名称:rose,代码行数:24,代码来源:instrumentationExample.C

示例11: joinMangledQualifiers

SgName
joinMangledQualifiers (const SgName& base, const SgName& name)
   {
#if 0
  // DQ (8/25/2006): This is debugging code required to find a problem that 
  // results in a 480,000,000 character string used of a mangled name prefix 
  // within the boost_tests/test_boost_phoenix_v2.C
     printf ("base.getString ().size() = %ld name.getString ().size() = %ld \n",base.getString().size(),name.getString().size());

     const int MODERATE_SIZE = 1000;
     if (base.getString().size() > MODERATE_SIZE)
          printf ("base.getString() = %s \n",base.getString().c_str());

     const int MAX_SIZE = 10000;
     ROSE_ASSERT(base.getString().size() < MAX_SIZE);
     ROSE_ASSERT(name.getString().size() < MAX_SIZE);
#endif

     string mangled_name = joinMangledQualifiersToString (base.getString (),name.getString ());
     return SgName (mangled_name.c_str ());
   }
开发者ID:InstRO,项目名称:InstRO-ROSE-Develop,代码行数:21,代码来源:manglingSupport.C

示例12: generateDeclarationString

string
AST_Rewrite::AccumulatedDeclarationsAttribute::
generateDeclarationString ( SgDeclarationStatement* declaration ) const
   {
  // This function generates a string for a declaration. The string is required for 
  // the intermediate file to make sure that all transformation code will compile 
  // (since it could depend on declarations defined within the code).

  // Details:
  //   1) Only record declarations found within the source file (exclude all header files 
  //      since they will be seen when the same header files are included).
  //   2) Resort the variable declarations to remove redundent entries.
  //        WRONG: variable declarations could have dependences upon class declarations!
  //   3) Don't sort all declarations since some could have dependences.
  //        a) class declarations
  //        b) typedefs
  //        c) function declarations
  //        d) template declarations
  //        e) variable definition???

      ROSE_ASSERT (this != NULL);
      ROSE_ASSERT ( declaration != NULL );
      string declarationString;

   // Build a SgUnparse_Info object to represent formatting options for
   // this statement (use the default values).
      SgUnparse_Info info;

   // exclude comments
      info.set_SkipComments();

   // exclude all CPP directives (since they have already been evaluated by the front-end)
      info.set_SkipCPPDirectives();

      switch ( declaration->variantT() )
        {
       // Enum declarations should not skip their definition since 
       // this is where the constants are declared.
          case V_SgEnumDeclaration:

          case V_SgVariableDeclaration:
          case V_SgTemplateDeclaration:
          case V_SgTypedefDeclaration:
            // Need to figure out if a forward declaration would work or be 
            // more conservative and always output the complete class definition.

            // turn off output of initializer values
               info.set_SkipInitializer();
            // output the declaration as a string
               declarationString = globalUnparseToString(declaration,&info);
               break;

          case V_SgClassDeclaration:
            // Need to figure out if a forward declaration would work or be 
            // more conservative and always output the complete class definition.

            // turn off the generation of the function definitions only 
            // (we still want the restof the class definition since these 
            // define all member data and member functions).
            // info.set_SkipClassDefinition();
               info.set_SkipFunctionDefinition();
               info.set_AddSemiColonAfterDeclaration();

            // output the declaration as a string
               declarationString = globalUnparseToString(declaration,&info);
               break;

       // For functions just output the declaration and skip the definition
       // (This also avoids the generation of redundent definitions since the 
       // function we are in when we generate all declarations would be included).
          case V_SgMemberFunctionDeclaration:
          case V_SgFunctionDeclaration:
             {
            // turn off the generation of the definition
               info.set_SkipFunctionDefinition();
               info.set_AddSemiColonAfterDeclaration();

            // output the declaration as a string
               declarationString = globalUnparseToString(declaration,&info);
               break;
             }

          case V_SgFunctionParameterList:
             {
            // Handle generation of declaration strings this case differnetly from unparser
            // since want to generate declaration strings and not function parameter lists
            // (function parameter lists would be delimited by "," while declarations would
            // be delimited by ";").
               SgFunctionParameterList* parameterListDeclaration = dynamic_cast<SgFunctionParameterList*>(declaration);
               ROSE_ASSERT (parameterListDeclaration != NULL);
               SgInitializedNameList & argList = parameterListDeclaration->get_args();
               SgInitializedNameList::iterator i;
               for (i = argList.begin(); i != argList.end(); i++)
                  {
                    string typeNameString = (*i).get_type()->unparseToString();
                 // (9/8/2003) Bug Fix suggested by Nils
                 // string variableName   = (*i).get_name().str();
                    string variableName;
                    SgName nodeName   = (*i).get_name();
                    if(nodeName.str() != NULL)
//.........这里部分代码省略.........
开发者ID:Sciumo,项目名称:rose,代码行数:101,代码来源:rewriteAccumulatedAttribute.C

示例13: ROSE_ASSERT


//.........这里部分代码省略.........
        ROSE_ASSERT (typeName.c_str() != NULL);

        string sidlParameterPassingMechanim = "in";

        //it seems like the has_ellipses value is wrong, so we'll set it
        functionType->set_has_ellipses(false);
        if(type->variantT() == V_SgTypeEllipse)
        {
            sidlParameterPassingMechanim = "inout";
            functionType->set_has_ellipses(true);
        }
        //else if (type->variantT() == V_SgTypeVoid)
        /*else if (rose::stringDuplicate(type->sage_class_name()) == "SgTypeVoid")
        {
        	printf("found a void\n");
        	//void type is only viable for a pointer.  foo(void) will just become foo()
        	if(isSgPointerType(type) != NULL)
        	{
        		printf("found a void pointer\n");
        		sidlParameterPassingMechanim ="inout opaque";
        	}
        }*/
        else if (isSgReferenceType(type) != NULL)
        {
            sidlParameterPassingMechanim = "inout";
        }
        else if (isSgPointerType(type) != NULL)
        {
            sidlParameterPassingMechanim = "inout";
        }
        else if (isSgArrayType(type) != NULL)
        {
            SgArrayType array = isSgArrayType(type);
            sidlParameterPassingMechanim = "inout Array<";
            SgType* baseType = array.get_base_type();
            sidlParameterPassingMechanim += TransformationSupport::getTypeName(baseType);
            sidlParameterPassingMechanim += ",1>";
            //FIXME: I don't see a way to determine the dimention of the array
        }



        // Build the substring for each parameter

        parameterTypesAndNames += sidlParameterPassingMechanim;
        parameterTypesAndNames += " ";

        //if(type->variantT() != V_SgTypeGlobalVoid)
        //{
        if(type->variantT() == V_SgTypeEllipse)
        {
            parameterTypesAndNames += "Array<BabelBaseType,1> "; //FIXME: need to include a declaration for BaseType
            parameterTypesAndNames += "elips" +  argumentCounter; //this fails to actually append the counter, but I don't think it will matter: kmk
        }
        else
        {
            SgName name = (*i)->get_name();
            string nameString = name.str();
            string typeName = TransformationSupport::getTypeName(type);

            if(typeName == "void")
            {
                if(nameString!="")
                {
                    parameterTypesAndNames += "opaque ";
                    parameterTypesAndNames += nameString;
                }
            }
            else
            {
                parameterTypesAndNames += typeName;
                parameterTypesAndNames += " ";
                if(nameString != "") //will be empty if the function declaration doesn't provide a name
                    parameterTypesAndNames += nameString;
            }
        }

        // Add a "," to the string if there are more parameters in the list
        if ( argumentCounter < argumentList.size()-1 )
            parameterTypesAndNames += ",";
        //}else printf("avoiding the void\n");
        argumentCounter++;
    }

    SgType* returnType = functionType->get_return_type();
    ROSE_ASSERT (returnType != NULL);
    string returnTypeName = "void";
    if(returnType->variantT() != V_SgTypeVoid)
        returnTypeName = TransformationSupport::getTypeName(returnType);


    string sidlMemberFunctionDeclaration = "          $RETURN_TYPE $FUNCTION_NAME($PARAMETERS);\n";

    sidlMemberFunctionDeclaration = StringUtility::copyEdit ( sidlMemberFunctionDeclaration, "$RETURN_TYPE" , returnTypeName );
    sidlMemberFunctionDeclaration = StringUtility::copyEdit ( sidlMemberFunctionDeclaration, "$FUNCTION_NAME" , sidlFunctionName );
    sidlMemberFunctionDeclaration = StringUtility::copyEdit ( sidlMemberFunctionDeclaration, "$PARAMETERS" , parameterTypesAndNames );


    return sidlMemberFunctionDeclaration;
}
开发者ID:billhoffman,项目名称:rose-develop,代码行数:101,代码来源:sidlFunction.C

示例14: tie

//! search for all possible (virtual) function calls 
vector<SgMemberFunctionDeclaration*> 
Classhierarchy::searchMemberFunctionCalls(SgMemberFunctionDeclaration* mfCall)
{
        vector<SgMemberFunctionDeclaration*> retvec;
        property_map< dbgType, boost::vertex_classhierarchy_t>::type chMap = boost::get( boost::vertex_classhierarchy, *this );

        SgClassDefinition *classDef  = mfCall->get_scope();
        SgName                                           classname = classDef->get_qualified_name(); // MANGLE
        string                                           cnamestr  = classname.str();
        graph_traits< dbgType >::vertex_iterator vi,vend;
        dbgVertex vdesc = *vi;
        bool foundVertex = false;
        tie(vi,vend) = vertices( *this );
        for(; vi!=vend; vi++) {
                //cerr << " BCH v i"<< get(vertex_index,*this,*vi)<< " i1" << get(vertex_index1, *this, *vi)<<","<< get(vertex_name, *this, *vi) << endl;
                if( get(vertex_dbg_data, *this, *vi).get_typeName() == cnamestr ) {
                        //cerr << " SMF srch "<< cnamestr <<" vi "<< get(vertex_index,*this,*vi)<< " i1" << get(vertex_index1, *this, *vi)<<","<< get(vertex_name, *this, *vi) << endl;
                        vdesc = *vi;
                        foundVertex = true;
                        break;
                }
        }
        if(!foundVertex) { cerr << " SMF srch "<< cnamestr <<" vi "<< get(vertex_index,*this,*vi)<< " i1" << get(vertex_index1, *this, *vi)<<","<< get(vertex_name, *this, *vi) << endl; }
        assert( foundVertex );

        set<dbgVertex> treeset;
        treeset.insert( vdesc );

        // first find "highest" class in CH that still provides this MF
        dbgVertex vhighest = vdesc; // first assume its the current one
        graph_traits<dbgType>::out_edge_iterator oi,oend;
        tie(oi,oend) = out_edges( vdesc, *this);
        for(; oi!=oend; oi++) {
                //cerr << " SMF inherits from "<< get(vertex_index,*this,target(*oi,*this))<< " i1" << get(vertex_index1, *this, target(*oi,*this))<<","<< get(vertex_name, *this, target(*oi,*this)) << endl;
                
                // does any of the base classes implement the member function?
                bool noParentImpl = true; 
                
                // check if this base class also implements MF
                for(set<SgNode*>::iterator chd= chMap[target(*oi,*this)].inherited.begin(); 
                                chd!= chMap[target(*oi,*this)].inherited.end(); chd++) {
                        SgFunctionDeclaration *inhFunc = isSgFunctionDeclaration( *chd );
                        bool virt = false;
                        //cerr << "  TOPO v srch1" << endl;
                        if(inhFunc->isVirtual()) virt = true;
                        if( (virt) && (compareFunctionDeclarations(inhFunc,mfCall)) ) {
                                // remeber for traversal
                                treeset.insert( target(*oi, *this) );
                                noParentImpl = false;
                        }
                }
                if(noParentImpl) {
                        // we found it
                        vhighest = target(*oi, *this);
                        break;
                }
        }
        //cerr << " SMF high "<< cnamestr <<" vi "<< get(vertex_index,*this,vhighest)<< " i1" << get(vertex_index1, *this, vhighest)<<","<< get(vertex_name, *this, vhighest) << endl; 

        // now traverse class hierachy downwards, for all children that implement this function, add to set
        set<dbgVertex> tovisit;
        set<dbgVertex> visited;
        tovisit.insert( vhighest );
        //hier weiter
        while( tovisit.size() > 0 ) {
                dbgVertex currVert = *(tovisit.begin());
                tovisit.erase( currVert );
                visited.insert( currVert );
        //cerr << " SMF visi "<< get(vertex_index,*this,currVert)<< " i1" << get(vertex_index1, *this, currVert)<<","<< get(vertex_name, *this, currVert) << endl; 
                for(set<SgNode*>::iterator chd= chMap[currVert].defined.begin(); chd!= chMap[currVert].defined.end(); chd++) {
                        SgMemberFunctionDeclaration*inhFunc = isSgMemberFunctionDeclaration( *chd );
                        if(compareFunctionDeclarations(inhFunc,mfCall)) {
                                retvec.push_back( inhFunc );
                        }
                }
                graph_traits<dbgType>::in_edge_iterator ii,iend;
                tie(ii,iend) = in_edges( currVert, *this);
                for(; ii!=iend; ii++) {
                        dbgVertex child = source(*ii, *this);
                        // only insert of not already visited
                        set<dbgVertex>::iterator found = visited.find( child );
                        if(found == visited.end()) 
                                tovisit.insert( child );
                }
        }

        //retvec.push_back( mfCall );
        return retvec;
}
开发者ID:Sciumo,项目名称:rose,代码行数:90,代码来源:Classhierarchy.C

示例15: buildAPPArrayRef

// Constructs _A_pointer[SC_A(_1,_2)]
SgPntrArrRefExp* buildAPPArrayRef(SgNode* astNode,
		ArrayAssignmentStatementQueryInheritedAttributeType & arrayAssignmentStatementQueryInheritedData,
		OperandDataBaseType & operandDataBase, SgScopeStatement* scope, SgExprListExp* parameterExpList) {
#if DEBUG
	printf("Contructing A++ array reference object \n");
#endif

	string returnString;

	SgVarRefExp* varRefExp = isSgVarRefExp(astNode);
	ROSE_ASSERT(varRefExp != NULL);
	SgVariableSymbol* variableSymbol = varRefExp->get_symbol();
	ROSE_ASSERT(variableSymbol != NULL);
	SgInitializedName* initializedName = variableSymbol->get_declaration();
	ROSE_ASSERT(initializedName != NULL);
	SgName variableName = initializedName->get_name();

	vector<SgExpression*> parameters;

	// Figure out the dimensionality of the statement globally
	int maxNumberOfIndexOffsets = 6; // default value for A++/P++ arrays
	ROSE_ASSERT(arrayAssignmentStatementQueryInheritedData.arrayStatementDimensionDefined == TRUE);
	if (arrayAssignmentStatementQueryInheritedData.arrayStatementDimensionDefined == TRUE) {
		// The the globally computed array dimension from the arrayAssignmentStatementQueryInheritedData
		maxNumberOfIndexOffsets = arrayAssignmentStatementQueryInheritedData.arrayStatementDimension;
	}

	// Then we want the minimum of all the dimensions accesses (or is it the maximum?)
	for (int n = 0; n < maxNumberOfIndexOffsets; n++) {
		parameters.push_back(buildVarRefExp("_" + StringUtility::numberToString(n + 1), scope));
	}

	// Make a reference to the global operand database
	//OperandDataBaseType & operandDataBase = accumulatorValue.operandDataBase;

	SgType* type = variableSymbol->get_type();
	ROSE_ASSERT(type != NULL);

	string typeName = TransformationSupport::getTypeName(type);
	ROSE_ASSERT(typeName.c_str() != NULL);

	// Copy the string from the SgName object to a string object
	string variableNameString = variableName.str();

	// Setup an intry in the synthesized attribute data base for this variable any
	// future results from analysis could be place there at this point as well
	// record the name in the synthesized attribute
	ROSE_ASSERT(operandDataBase.transformationOption > ArrayTransformationSupport::UnknownIndexingAccess);
	ArrayOperandDataBase arrayOperandDB = operandDataBase.setVariableName(variableNameString);

	// We could have specified in the inherited attribute that this array variable was
	// index and if so leave the value of $IDENTIFIER_STRING to be modified later in
	// the assembly of the operator() and if not do the string replacement on
	// $IDENTIFIER_STRING here (right now).

	returnString = string("$IDENTIFIER_STRING") + string("_pointer[SC") + string("$MACRO_NAME_SUBSTRING") + string("(")
			+ string("$OFFSET") + string(")]");

	string functionSuffix = "";
	SgPntrArrRefExp* pntrRefExp;

	cout << " arrayAssignmentStatementQueryInheritedData.getIsIndexedArrayOperand() "
			<< arrayAssignmentStatementQueryInheritedData.getIsIndexedArrayOperand() << endl;
	// The inherited attribute mechanism is not yet implimented
	if (arrayAssignmentStatementQueryInheritedData.getIsIndexedArrayOperand() == FALSE)
	//if(true)
	{
		// do the substitution of $OFFSET here since it our last chance
		// (offsetString is the list of index values "index1,index2,...,indexn")
		//returnString = StringUtility::copyEdit(returnString,"$OFFSET",offsetString);

		string operandIdentifier = arrayOperandDB.generateIdentifierString();
		// do the substitution of $IDENTIFIER_STRING here since it our last chance
		// if variable name is "A", generate: A_pointer[SC_A(index1,...)]
		// returnString = StringUtility::copyEdit (returnString,"$IDENTIFIER_STRING",variableNameString);
		ROSE_ASSERT(arrayOperandDB.indexingAccessCode > ArrayTransformationSupport::UnknownIndexingAccess);

		// Edit into place the name of the data pointer
		returnString = StringUtility::copyEdit(returnString, "$IDENTIFIER_STRING", operandIdentifier);

		// Optimize the case of uniform or unit indexing to generate a single subscript macro definition
		if ((arrayOperandDB.indexingAccessCode == ArrayTransformationSupport::UniformSizeUnitStride)
				|| (arrayOperandDB.indexingAccessCode == ArrayTransformationSupport::UniformSizeUniformStride))
			returnString = StringUtility::copyEdit(returnString, "$MACRO_NAME_SUBSTRING", "");
		else {
			returnString = StringUtility::copyEdit(returnString, "$MACRO_NAME_SUBSTRING", operandIdentifier);
			functionSuffix = operandIdentifier;
		}

		/* 
		 * Create SgPntrArrRefExp lhs is VarRefExp and rhs is SgFunctionCallExp
		 */
		SgVarRefExp* newVarRefExp = buildVarRefExp(operandIdentifier + "_pointer", scope);

		string functionName = "SC" + functionSuffix;

		SgFunctionCallExp* functionCallExp;
		if (parameterExpList == NULL)
			functionCallExp = buildFunctionCallExp(functionName, buildIntType(), buildExprListExp(parameters), scope);
//.........这里部分代码省略.........
开发者ID:8l,项目名称:rose,代码行数:101,代码来源:arrayAssignmentStatementAssembly.C


注:本文中的SgName类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。