[LLVMdev] CallGraphSCC
Duncan Sands
baldrick at free.fr
Wed Oct 19 11:44:13 PDT 2011
Hi Ryan,
> I want to access the instructions via:
> CallGraph->CallGraphNode->Function->BB->Instruction
>
> Is this possible?
>
> Right now, I'm iterating over the CallGraph Nodes via CallGraphSCC:iterator, but
> then I have to cast that iterator to a CallGraphNode const
you should be able to use (*I)->getFunction()
and then when I call
> CallGraphNode->getFunction, it returns a valid function but seg faults on
> function->getName()?
All functions defined outside the module are represented by the null pointer.
So if for example you declare a function foo, but it has no body, and call it
from somewhere in your module, then foo is considered part of the "external
SCC"; when you do getFunction() for this SCC node you will get a null pointer.
Ciao, Duncan.
More information about the llvm-dev
mailing list