本文整理汇总了C++中CFGNode::inEdges方法的典型用法代码示例。如果您正苦于以下问题:C++ CFGNode::inEdges方法的具体用法?C++ CFGNode::inEdges怎么用?C++ CFGNode::inEdges使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFGNode
的用法示例。
在下文中一共展示了CFGNode::inEdges方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: advance
// advances this CFGIterator in the given direction. Forwards if fwDir=true and backwards if fwDir=false.
// if pushAllChildren=true, all of the current node's unvisited children (predecessors or successors,
// depending on fwDir) are pushed onto remainingNodes
// It is assumed that for a given CFGIterator pushAllChildren either always = true or always = false.
void CFGIterator::advance(bool fwDir, bool pushAllChildren)
{
assert(initialized);
/*scope s(txt()<<"CFGIterator::advance(fwDir="<<fwDir<<", pushAllChildren="<<pushAllChildren<<") #remainingNodes="<<remainingNodes.size());
dbg<<" visited=\n";
for(set<CFGNode>::iterator it=visited.begin(); it!=visited.end(); it++)
dbg << " "<<CFGNode2Str(*it)<<"\n";*/
if(remainingNodes.size()>0)
{
// pop the next CFG node from the front of the list
CFGNode cur = remainingNodes.front();
remainingNodes.pop_front();
//dbg << "cur="<<CFGNode2Str(cur)<<endl;
if(pushAllChildren)
{
// find its followers (either successors or predecessors, depending on value of fwDir), push back
// those that have not yet been visited
vector<CFGEdge> nextE;
if(fwDir) {
/* // Do not proceed forward if we've reached the end of a function
if(!(isSgFunctionDefinition(cur.getNode()) && cur.getIndex()==3))*/
nextE = cur.outEdges();
} else {
/* // Do not proceed backward if we've reached the end of a function
if(!(isSgFunctionParameterList(cur.getNode()) && cur.getIndex()==0)) */
nextE = cur.inEdges();
}
//dbg << " #nextE="<<nextE.size()<<endl;
for(vector<CFGEdge>::iterator it=nextE.begin(); it!=nextE.end(); it++)
{
CFGNode nextN = (fwDir ? it->target() : nextN = it->source());
/*dbg << " nextN="<<CFGNode2Str(nextN)<<endl;
dbg << " CFGIterator::advance "<<(fwDir?"descendant":"predecessor")<<": "<<
"visited="<<(visited.find(nextN) != visited.end())<<
" remaining="<<isRemaining(nextN)<<"\n";*/
// if we haven't yet visited this node and don't yet have it on the remainingNodes list
if(visited.find(nextN) == visited.end() &&
!isRemaining(nextN))
{
//printf(" pushing back node <%s: 0x%x: %s> visited=%d\n", nextN.getNode()->class_name().c_str(), nextN.getNode(), nextN.getNode()->unparseToString().c_str(), visited.find(nextN)!=visited.end());
remainingNodes.push_back(nextN);
}
}
// if we still have any nodes left remaining
if(remainingNodes.size()>0)
{
// take the next node from the front of the list and mark it as visited
visited.insert(remainingNodes.front());
//cout << " remainingNodes.front()=["<<remainingNodes.front().getNode()->unparseToString()<<" | "<<remainingNodes.front().getNode()->class_name()<<"]"<<endl;
}
// Since pushAllChildren always = true or = false, we only need to worry about managing visited in the true case
}
}
}