bool hasCallee() const { return begin() != end(); }
std::string getName() const { return F.getPrintableName(); }
+
+ Decl *getDecl(ASTContext &Ctx) const { return F.getDecl(Ctx); }
};
class CallGraph {
CallGraphNode *getOrInsertFunction(idx::Entity F);
+ Decl *getDecl(CallGraphNode *Node);
+
void print(llvm::raw_ostream &os);
void dump();
return Node = new CallGraphNode(F);
}
+Decl *CallGraph::getDecl(CallGraphNode *Node) {
+ // Get the function's context.
+ ASTContext *Ctx = CallerCtx[Node];
+
+ return Node->getDecl(*Ctx);
+}
+
void CallGraph::print(llvm::raw_ostream &os) {
for (iterator I = begin(), E = end(); I != E; ++I) {
if (I->second->hasCallee()) {