[cfe-commits] r107461 - in /cfe/trunk: examples/wpa/clang-wpa.cpp include/clang/Index/CallGraph.h lib/Index/CallGraph.cpp

Zhongxing Xu xuzhongxing at gmail.com
Thu Jul 1 23:39:46 PDT 2010


Author: zhongxingxu
Date: Fri Jul  2 01:39:46 2010
New Revision: 107461

URL: http://llvm.org/viewvc/llvm-project?rev=107461&view=rev
Log:
Change CallGraph::Prog to be a reference. idx::Program means to be a global object to the Index library.

Modified:
    cfe/trunk/examples/wpa/clang-wpa.cpp
    cfe/trunk/include/clang/Index/CallGraph.h
    cfe/trunk/lib/Index/CallGraph.cpp

Modified: cfe/trunk/examples/wpa/clang-wpa.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/examples/wpa/clang-wpa.cpp?rev=107461&r1=107460&r2=107461&view=diff
==============================================================================
--- cfe/trunk/examples/wpa/clang-wpa.cpp (original)
+++ cfe/trunk/examples/wpa/clang-wpa.cpp Fri Jul  2 01:39:46 2010
@@ -31,6 +31,8 @@
   FileManager FileMgr;
   std::vector<ASTUnit*> ASTUnits;
 
+  Program Prog;
+
   if (InputFilenames.empty())
     return 0;
 
@@ -47,7 +49,7 @@
   }
 
   llvm::OwningPtr<CallGraph> CG;
-  CG.reset(new CallGraph());
+  CG.reset(new CallGraph(Prog));
 
   for (unsigned i = 0, e = ASTUnits.size(); i != e; ++i)
     CG->addTU(ASTUnits[i]->getASTContext());

Modified: cfe/trunk/include/clang/Index/CallGraph.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Index/CallGraph.h?rev=107461&r1=107460&r2=107461&view=diff
==============================================================================
--- cfe/trunk/include/clang/Index/CallGraph.h (original)
+++ cfe/trunk/include/clang/Index/CallGraph.h Fri Jul  2 01:39:46 2010
@@ -54,7 +54,7 @@
 
 class CallGraph {
   /// Program manages all Entities.
-  idx::Program Prog;
+  idx::Program &Prog;
 
   typedef std::map<idx::Entity, CallGraphNode *> FunctionMapTy;
 
@@ -71,7 +71,7 @@
   CallGraphNode *ExternalCallingNode;
 
 public:
-  CallGraph();
+  CallGraph(idx::Program &P);
   ~CallGraph();
 
   typedef FunctionMapTy::iterator iterator;

Modified: cfe/trunk/lib/Index/CallGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/CallGraph.cpp?rev=107461&r1=107460&r2=107461&view=diff
==============================================================================
--- cfe/trunk/lib/Index/CallGraph.cpp (original)
+++ cfe/trunk/lib/Index/CallGraph.cpp Fri Jul  2 01:39:46 2010
@@ -55,7 +55,7 @@
   }
 }
 
-CallGraph::CallGraph() : Root(0) {
+CallGraph::CallGraph(Program &P) : Prog(P), Root(0) {
   ExternalCallingNode = getOrInsertFunction(Entity());
 }
 





More information about the cfe-commits mailing list