119 enum direction {fw=0, bw=1};
123 std::set<SgGraphNode*>::iterator itn;
124 std::set<SgDirectedGraphEdge*> edges;
125 std::set<SgDirectedGraphEdge*>::iterator ite;
129 std::set<SgGraphNode*> visitedCGNodes;
149 itn = func->cgNodes.begin();
150 if(dir == fw) edges = func->graph->computeEdgeSetOut(*itn);
151 else edges = func->graph->computeEdgeSetIn(*itn);
154 advanceToNextValidPoint();
159 const CGFunction* getTarget(std::set<CGFunction> &functions)
162 SgGraphNode* target = (dir == fw ? (*ite)->get_to() : (*ite)->get_from());
163 ROSE_ASSERT(isSgFunctionDeclaration(target->get_SgNode()));
164 assert(!isSgTemplateFunctionDeclaration(target->get_SgNode()));
170 for(std::set<CGFunction>::const_iterator it = functions.begin(); it!=functions.end(); it++)
174 if((&(*it))->cgNodes.find(target) != (&(*it))->cgNodes.end())
181 ROSE_ASSERT(!
"Error finding the target function of a call graph edge when the target is not compiler generated!");
188 SgGraphNode* target = (dir == fw ? (*ite)->get_to() : (*ite)->get_from());
189 ROSE_ASSERT(isSgFunctionDeclaration(target->get_SgNode()));
190 assert(!isSgTemplateFunctionDeclaration(target->get_SgNode()));
191 Function result(isSgFunctionDeclaration(target->get_SgNode()));
195 void operator ++(
int )
199 advanceToNextValidPoint();
204 void advanceToNextValidPoint()
211 if(ite == edges.end())
218 if(itn != func->cgNodes.end())
221 if(dir == fw) edges = func->graph->computeEdgeSetOut(*itn);
222 else edges = func->graph->computeEdgeSetIn(*itn);
235 SgGraphNode* target = (dir == fw ? (*ite)->get_to() : (*ite)->get_from());
237 if(visitedCGNodes.find(target) != visitedCGNodes.end())
241 visitedCGNodes.insert(target);
248 bool operator == (
const iterator& that)
251 if(finished)
return that.finished;
252 else if(that.finished)
return finished;
255 return (dir == that.dir) &&
257 (edges == that.edges) &&
262 bool operator != (
const iterator& that)
263 {
return !((*this) == that); }