[cfe-commits] r76940 - in /cfe/trunk: include/clang/Analysis/CallGraph.h lib/Analysis/CallGraph.cpp

Zhongxing Xu xuzhongxing at gmail.com
Thu Jul 23 20:41:11 PDT 2009


Author: zhongxingxu
Date: Thu Jul 23 22:41:11 2009
New Revision: 76940

URL: http://llvm.org/viewvc/llvm-project?rev=76940&view=rev
Log:
Add getDecl() to CallGraph and CallGraphNode.

Modified:
    cfe/trunk/include/clang/Analysis/CallGraph.h
    cfe/trunk/lib/Analysis/CallGraph.cpp

Modified: cfe/trunk/include/clang/Analysis/CallGraph.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/CallGraph.h?rev=76940&r1=76939&r2=76940&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/CallGraph.h (original)
+++ cfe/trunk/include/clang/Analysis/CallGraph.h Thu Jul 23 22:41:11 2009
@@ -49,6 +49,8 @@
   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 @@
 
   CallGraphNode *getOrInsertFunction(idx::Entity F);
 
+  Decl *getDecl(CallGraphNode *Node);
+
   void print(llvm::raw_ostream &os);
   void dump();
 

Modified: cfe/trunk/lib/Analysis/CallGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CallGraph.cpp?rev=76940&r1=76939&r2=76940&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/CallGraph.cpp (original)
+++ cfe/trunk/lib/Analysis/CallGraph.cpp Thu Jul 23 22:41:11 2009
@@ -108,6 +108,13 @@
   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()) {





More information about the cfe-commits mailing list