I want to generate the call graph for a particular function in a .cpp file. I get the function's decl by using AST Matcher. Then, I pass the decl to the addToCallGraph function;
clang::CallGraph CG;
CG.addToCallGraph(std::move(function_decl));
After that, I try to print the call graph:
std::string str;
llvm::raw_string_ostream os(str);
CG.print(os);
std::cout<<os.str()<<std::endl;
However, I found the result is not complete. For example the call relation is A()->B(); B()->C() the result is:
Function: < root > calls: A B
Function: A calls: B
Function: B calls:
The relationship between B and C has not been shown.
My questions are,
1) Does addToCallGraph complete all the call graph generation process?
2) How can we check all the relationship between A,B and C?
Thanks in advance!