[llvm-commits] CVS: llvm/lib/Analysis/IPA/CallGraph.cpp

Chris Lattner sabre at nondot.org
Tue Dec 5 11:46:26 PST 2006



Changes in directory llvm/lib/Analysis/IPA:

CallGraph.cpp updated: 1.60 -> 1.61
---
Log message:

straighten out various memory ownership issues in the callgraph stuff.
This fixes Regression/Other/2002-01-31-CallGraph.ll.


---
Diffs of the changes:  (+2 -3)

 CallGraph.cpp |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)


Index: llvm/lib/Analysis/IPA/CallGraph.cpp
diff -u llvm/lib/Analysis/IPA/CallGraph.cpp:1.60 llvm/lib/Analysis/IPA/CallGraph.cpp:1.61
--- llvm/lib/Analysis/IPA/CallGraph.cpp:1.60	Mon Dec  4 15:22:45 2006
+++ llvm/lib/Analysis/IPA/CallGraph.cpp	Tue Dec  5 13:46:12 2006
@@ -51,11 +51,9 @@
 
 public:
   BasicCallGraph() : Root(0), ExternalCallingNode(0), CallsExternalNode(0) {}
-  ~BasicCallGraph() { destroy(); }
 
   // runOnModule - Compute the call graph for the specified module.
   virtual bool runOnModule(Module &M) {
-    destroy();
     CallGraph::initialize(M);
     
     ExternalCallingNode = getOrInsertFunction(0);
@@ -182,8 +180,10 @@
   //
   // destroy - Release memory for the call graph
   virtual void destroy() {
+    /// CallsExternalNode is not in the function map, delete it explicitly.
     delete CallsExternalNode;
     CallsExternalNode = 0;
+    CallGraph::destroy();
   }
 };
 
@@ -194,7 +194,6 @@
 } //End anonymous namespace
 
 void CallGraph::initialize(Module &M) {
-  destroy();
   Mod = &M;
 }
 






More information about the llvm-commits mailing list