本文整理汇总了C++中AstAttributeMechanism::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ AstAttributeMechanism::begin方法的具体用法?C++ AstAttributeMechanism::begin怎么用?C++ AstAttributeMechanism::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AstAttributeMechanism
的用法示例。
在下文中一共展示了AstAttributeMechanism::begin方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
// DQ (11/1/2003) added mechanism to add additional options (to add color, etc.)
string
AstDOTGeneration::additionalEdgeInfo(SgNode* from, SgNode* to, string label)
{
// return an empty string for default implementation
#if 0
ostringstream ss;
// DQ (7/4/2008): Added support for output of information about attributes
AstAttributeMechanism* astAttributeContainer = node->get_attributeMechanism();
if (astAttributeContainer != NULL)
{
for (AstAttributeMechanism::iterator i = astAttributeContainer->begin(); i != astAttributeContainer->end(); i++)
{
// std::string name = i->first;
AstAttribute* attribute = i->second;
ROSE_ASSERT(attribute != NULL);
ss << attribute->additionalEdgeInfo();
}
}
return ss.str();
#endif
return "";
}
示例2: printf
// DQ (11/1/2003) added mechanism to add additional options (to add color, etc.)
string
AstDOTGeneration::additionalNodeOptions(SgNode* node)
{
// return an empty string for default implementation
ostringstream ss;
// DQ (7/4/2008): Added support for output of information about attributes
AstAttributeMechanism* astAttributeContainer = node->get_attributeMechanism();
if (astAttributeContainer != NULL)
{
#if 0
printf ("In AstDOTGeneration::additionalNodeOptions(): astAttributeContainer = %p for node = %p = %s \n",astAttributeContainer,node,node->class_name().c_str());
#endif
for (AstAttributeMechanism::iterator i = astAttributeContainer->begin(); i != astAttributeContainer->end(); i++)
{
// std::string name = i->first;
AstAttribute* attribute = i->second;
ROSE_ASSERT(attribute != NULL);
ss << attribute->additionalNodeOptions();
}
}
else
{
#if 0
printf ("In AstDOTGeneration::additionalNodeOptions(): astAttributeContainer == NULL for node = %p = %s \n",node,node->class_name().c_str());
#endif
}
return ss.str();
}
示例3: addAdditionalNodesAndEdges
void AstDOTGeneration::addAdditionalNodesAndEdges(SgNode* node)
{
//*****
// Nodes and edges can be annotated with additional information. This information is in
// the form of additional nodes and edges. These is added to the output on a per-node basis.
// DQ (7/4/2008): Support for edges specified in AST attributes
AstAttributeMechanism* astAttributeContainer = node->get_attributeMechanism();
if (astAttributeContainer != NULL)
{
// Loop over all the attributes at this IR node
for (AstAttributeMechanism::iterator i = astAttributeContainer->begin(); i != astAttributeContainer->end(); i++)
{
// std::string name = i->first;
AstAttribute* attribute = i->second;
ROSE_ASSERT(attribute != NULL);
// This can return a non-empty list in user-defined attributes (derived from AstAttribute).
// printf ("Calling attribute->additionalNodeInfo() \n");
std::vector<AstAttribute::AttributeNodeInfo> nodeList = attribute->additionalNodeInfo();
// printf ("nodeList.size() = %lu \n",nodeList.size());
for (std::vector<AstAttribute::AttributeNodeInfo>::iterator i_node = nodeList.begin(); i_node != nodeList.end(); i_node++)
{
SgNode* nodePtr = i_node->nodePtr;
string nodelabel = i_node->label;
string nodeoption = i_node->options;
// printf ("In AstDOTGeneration::evaluateSynthesizedAttribute(): Adding a node nodelabel = %s nodeoption = %s \n",nodelabel.c_str(),nodeoption.c_str());
// dotrep.addNode(NULL,dotrep.traceFormat(ia.tdTracePos)+nodelabel,nodeoption);
// dotrep.addNode( nodePtr, dotrep.traceFormat(ia.tdTracePos) + nodelabel, nodeoption );
dotrep.addNode( nodePtr, nodelabel, nodeoption );
}
// printf ("Calling attribute->additionalEdgeInfo() \n");
std::vector<AstAttribute::AttributeEdgeInfo> edgeList = attribute->additionalEdgeInfo();
// printf ("edgeList.size() = %lu \n",edgeList.size());
for (std::vector<AstAttribute::AttributeEdgeInfo>::iterator i_edge = edgeList.begin(); i_edge != edgeList.end(); i_edge++)
{
string edgelabel = i_edge->label;
string edgeoption = i_edge->options;
// printf ("In AstDOTGeneration::evaluateSynthesizedAttribute(): Adding an edge from i_edge->fromNode = %p to i_edge->toNode = %p edgelabel = %s edgeoption = %s \n",i_edge->fromNode,i_edge->toNode,edgelabel.c_str(),edgeoption.c_str());
dotrep.addEdge(i_edge->fromNode,edgelabel,i_edge->toNode,edgeoption + "dir=forward");
}
}
}
}
示例4: sourcePositionInformation
// To improve the default output add additional information here
// Note you need to add "\\n" for newline
string
AstDOTGeneration::additionalNodeInfo(SgNode* node)
{
ostringstream ss;
ss << "\\n";
// print number of max successors (= container size)
AstSuccessorsSelectors::SuccessorsContainer c;
AstSuccessorsSelectors::selectDefaultSuccessors(node,c);
ss << c.size() << "\\n";
// add memory location of node to dot output
ss << node << "\\n";
// DQ (8/31/2013): Added more information about the IR node to the dot graph.
ss << sourcePositionInformation(node);
// DQ (9/19/2013): Added more information about the IR node to the dot graph (comments and C preprocessor directive information).
ss << commentAndCppInformation(node);
// DQ (7/4/2008): Added support for output of information about attributes
AstAttributeMechanism* astAttributeContainer = node->get_attributeMechanism();
if (astAttributeContainer != NULL)
{
ss << "Attribute list (size=" << astAttributeContainer->size() << "):" << "\\n";
for (AstAttributeMechanism::iterator i = astAttributeContainer->begin(); i != astAttributeContainer->end(); i++)
{
// pair<std::string,AstAttribute*>
AstAttribute* attribute = i->second;
ROSE_ASSERT(attribute != NULL);
// Note cast to void*
std::string name = i->first;
std::string label = name + " : " + attribute->toString();
ss << label << "\\n";
}
ss << "\\n";
ss << "\\n";
}
return ss.str();
}
示例5:
AstAttributeMechanism::AstAttributeMechanism ( const AstAttributeMechanism & X )
{
// This is the copy constructor to support deep copies of AST attribute containers.
// this is important for the support of the AST Copy mechanism (used all over the place,
// but being tested in new ways within the bug seeding project).
// Note that AstAttributeMechanism is derived from: AttributeMechanism<std::string,AstAttribute*>
// Which is defined as: template<class Key,class Value> class AttributeMechanism : protected std::map<Key,Value>
#if 1
// Iterate over all the elements of the map in X and copy them to the current map (this)
for (const_iterator iter = X.begin(); iter != X.end(); iter++)
{
// Call the copy mechanism on the AstAttribute (virtual copy constructor)
this->insert(std::make_pair( iter->first , _clone_attribute(iter->second) ));
}
#else
// ((const AttributeMechanism<std::string,AstAttribute*>*) this) = X;
*this = X;
#endif
}
示例6: DOTSynthesizedAttribute
//.........这里部分代码省略.........
// DQ (7/27/2008): For now just return to test this mechanism, then we want to add comment "//" propoerly to generated DOT file.
if (SgProject::get_verbose() > 0)
{
printf ("Skipping the use of this IR node in the DOT Graph \n");
}
}
else
{
// **************************
switch(traversal)
{
case TOPDOWNBOTTOMUP:
dotrep.addNode(node,dotrep.traceFormat(ia.tdbuTracePos,tdbuTrace)+nodelabel,nodeoption);
break;
case PREORDER:
case TOPDOWN:
dotrep.addNode(node,dotrep.traceFormat(ia.tdTracePos)+nodelabel,nodeoption);
break;
case POSTORDER:
case BOTTOMUP:
dotrep.addNode(node,dotrep.traceFormat(buTrace)+nodelabel,nodeoption);
break;
default:
assert(false);
}
++tdbuTrace;
++buTrace;
// add edges or null values
int testnum=0;
for (iter = l.begin(); iter != l.end(); iter++)
{
string edgelabel = string(node->get_traversalSuccessorNamesContainer()[testnum]);
string toErasePrefix = "p_";
if (AstTests::isPrefix(toErasePrefix,edgelabel))
{
edgelabel.erase(0, toErasePrefix.size());
}
if ( iter->node == NULL)
{
// SgNode* snode=node->get_traversalSuccessorContainer()[testnum];
AstSuccessorsSelectors::SuccessorsContainer c;
AstSuccessorsSelectors::selectDefaultSuccessors(node,c);
SgNode* snode=c[testnum];
// isDefault shows that the default constructor for synth attribute was used
if (l[testnum].isDefault() && snode && (visitedNodes.find(snode) != visitedNodes.end()) )
{
// handle bugs in SAGE
dotrep.addEdge(node,edgelabel,snode,"dir=forward arrowhead=\"odot\" color=red ");
}
else
{
if (snode == NULL)
{
dotrep.addNullValue(node,"",edgelabel,"");
}
}
}
else
{