Use Callgraph

Hi All,

I tried to use CallGraph in llvm by adding "AU.addRequired<CallGraph>();" in getAnalysisUsage function.

But it reports an error:

include/llvm/PassAnalysisSupport.h:56:39: error: ‘ID’ is not a member of ‘llvm::CallGraph’
      return addRequiredID(PassClass::ID);

How to use it correctly?


I believe you want to use CallGraphWrapperPass for this, as CallGraph itself isn't a pass. Correct me if I'm wrong.

Gordon Keiser
Software Development Engineer
Arxan Technologies

Oh, you're right. Thank you.

Another question: Given two CallGraphNodes (caller and callee) in CallGraph, How to map the edge in CallGraph to CallInst?