Change CallGraph::Prog to be a reference. idx::Program means to be a global object to the Index library.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107461 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/examples/wpa/clang-wpa.cpp b/examples/wpa/clang-wpa.cpp
index b515e33..c75626d 100644
--- a/examples/wpa/clang-wpa.cpp
+++ b/examples/wpa/clang-wpa.cpp
@@ -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());
diff --git a/include/clang/Index/CallGraph.h b/include/clang/Index/CallGraph.h
index 5edfe6f..336bf47 100644
--- a/include/clang/Index/CallGraph.h
+++ b/include/clang/Index/CallGraph.h
@@ -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;
diff --git a/lib/Index/CallGraph.cpp b/lib/Index/CallGraph.cpp
index 6403319..dedcc0e 100644
--- a/lib/Index/CallGraph.cpp
+++ b/lib/Index/CallGraph.cpp
@@ -55,7 +55,7 @@
   }
 }
 
-CallGraph::CallGraph() : Root(0) {
+CallGraph::CallGraph(Program &P) : Prog(P), Root(0) {
   ExternalCallingNode = getOrInsertFunction(Entity());
 }