I'm building a SCCPass below, it appears that the CallGraphNode->getFunction returns a valid function but seg faults on call like "getName" or "size" but not on calls like "empty" (which returns false).<br>
<br>My understanding is that the heirarchy is: CallGraphSCC->CallGraphNode->Function->BasicBlock->Instruction, is this not the case?<br><br> virtual bool runOnSCC(CallGraphSCC &SCC) {<br> errs() << "CDFGPass: " << "\n";<br>
errs() <<"Size of SCC: "<<SCC.size()<<"\n";<br> for(CallGraphSCC::iterator CGNodeItr = SCC.begin(); CGNodeItr != SCC.end();++CGNodeItr)<br> {<br> errs()<<"Iterating CallNodeGraphs"<<"\n";<br>
const CallGraphNode *CGNode = cast<CallGraphNode>(&*CGNodeItr);<br> errs()<<"Getting Function"<<"\n";<br> F = CGNode->getFunction();<br>
if (F) {<br> errs()<<"function is good"<<"\n"; }<br> if (F->empty()) {<br> errs()<<"function is empty"<<"\n"; }<br>
else {<br> errs()<<"basic blocks in function"<<"\n";<br> size_t F_size = F->size(); }<br> for(Function::iterator BBitr=F->begin(); BBitr!=F->end(); ++BBitr)<br>
{<br> errs()<<"basic block begin"<<"\n";<br> const BasicBlock* BB = cast<BasicBlock>(&*BBitr);<br> errs()<<"basic block end"<<"\n";<br>
}<br> errs()<<*CGNodeItr<<"\n";<br> errs()<<"Loop Back to Call Graph Node"<<"\n";<br> }<br> errs()<<"END"<<"\n";<br>
return false;<br> }<br><br>