Add getDecl() to CallGraph and CallGraphNode.

llvm-svn: 76940
This commit is contained in:
Zhongxing Xu 2009-07-24 03:41:11 +00:00
parent 6c82313375
commit 30ac7607be
2 changed files with 11 additions and 0 deletions

View File

@ -49,6 +49,8 @@ public:
bool hasCallee() const { return begin() != end(); }
std::string getName() const { return F.getPrintableName(); }
Decl *getDecl(ASTContext &Ctx) const { return F.getDecl(Ctx); }
};
class CallGraph {
@ -91,6 +93,8 @@ public:
CallGraphNode *getOrInsertFunction(idx::Entity F);
Decl *getDecl(CallGraphNode *Node);
void print(llvm::raw_ostream &os);
void dump();

View File

@ -108,6 +108,13 @@ CallGraphNode *CallGraph::getOrInsertFunction(Entity F) {
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()) {