diff options
| author | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-07-24 03:41:11 +0000 | 
|---|---|---|
| committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-07-24 03:41:11 +0000 | 
| commit | 30ac7607be10a493078f4cacb40f17836b8e0c25 (patch) | |
| tree | bc57047cfca2029727a2504cbe8ac07f8eedda4b | |
| parent | 6c8231337547d3617196e532080625916596785b (diff) | |
| download | bcm5719-llvm-30ac7607be10a493078f4cacb40f17836b8e0c25.tar.gz bcm5719-llvm-30ac7607be10a493078f4cacb40f17836b8e0c25.zip  | |
Add getDecl() to CallGraph and CallGraphNode.
llvm-svn: 76940
| -rw-r--r-- | clang/include/clang/Analysis/CallGraph.h | 4 | ||||
| -rw-r--r-- | clang/lib/Analysis/CallGraph.cpp | 7 | 
2 files changed, 11 insertions, 0 deletions
diff --git a/clang/include/clang/Analysis/CallGraph.h b/clang/include/clang/Analysis/CallGraph.h index 8c437c5261b..fabeea38d59 100644 --- a/clang/include/clang/Analysis/CallGraph.h +++ b/clang/include/clang/Analysis/CallGraph.h @@ -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(); diff --git a/clang/lib/Analysis/CallGraph.cpp b/clang/lib/Analysis/CallGraph.cpp index 07c2b35349f..1e28411eb46 100644 --- a/clang/lib/Analysis/CallGraph.cpp +++ b/clang/lib/Analysis/CallGraph.cpp @@ -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()) {  | 

