diff options
author | Chris Lattner <sabre@nondot.org> | 2006-12-05 19:46:12 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-12-05 19:46:12 +0000 |
commit | f2d9ceb5b9dfbd5e50607bab4a87c1244bda0a71 (patch) | |
tree | fbbc059574a3642abe8f697ccb6d438b0d608fdd /lib/Analysis/IPA/CallGraph.cpp | |
parent | 8257bee70bc45179d401e970faf67405b6cf46a2 (diff) |
straighten out various memory ownership issues in the callgraph stuff.
This fixes Regression/Other/2002-01-31-CallGraph.ll.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32237 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/IPA/CallGraph.cpp')
-rw-r--r-- | lib/Analysis/IPA/CallGraph.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/Analysis/IPA/CallGraph.cpp b/lib/Analysis/IPA/CallGraph.cpp index 61d00f0252..128e11ebd7 100644 --- a/lib/Analysis/IPA/CallGraph.cpp +++ b/lib/Analysis/IPA/CallGraph.cpp @@ -51,11 +51,9 @@ class BasicCallGraph : public CallGraph, public ModulePass { 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 @@ private: // // 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 @@ RegisterAnalysisGroup<CallGraph, true> Z(Y); } //End anonymous namespace void CallGraph::initialize(Module &M) { - destroy(); Mod = &M; } |