本文整理汇总了C++中SgGraphNode::addNewAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ SgGraphNode::addNewAttribute方法的具体用法?C++ SgGraphNode::addNewAttribute怎么用?C++ SgGraphNode::addNewAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SgGraphNode
的用法示例。
在下文中一共展示了SgGraphNode::addNewAttribute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: buildCFG
void CFG::buildCFG(CFGNode n)
{
ROSE_ASSERT(n.getNode());
if (explored_.count(n) > 0)
return;
explored_.insert(n);
SgGraphNode* from = NULL;
if (all_nodes_.count(n) > 0)
{
from = all_nodes_[n];
}
else
{
from = new SgGraphNode;
from->set_SgNode(n.getNode());
from->addNewAttribute("info", new CFGNodeAttribute(n.getIndex(), graph_));
all_nodes_[n] = from;
graph_->addNode(from);
}
std::vector<VirtualCFG::CFGEdge> outEdges = n.outEdges();
foreach (const VirtualCFG::CFGEdge& edge, outEdges)
{
CFGNode tar = edge.target();
SgGraphNode* to = NULL;
if (all_nodes_.count(tar) > 0)
to = all_nodes_[tar];
else
{
to = new SgGraphNode;
to->set_SgNode(tar.getNode());
to->addNewAttribute("info", new CFGNodeAttribute(tar.getIndex(), graph_));
all_nodes_[tar] = to;
graph_->addNode(to);
}
graph_->addDirectedEdge(new SgDirectedGraphEdge(from, to));
}