From 64cc1b0043a499b15e6d6d6ca99ecbf698ea86b1 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 25 Oct 2013 15:01:34 +0000 Subject: Call destroy from ~BasicCallGraph. This fix a memory leak found by valgrind. Calling it from the base class destructor would not destroy the BasicCallGraph bits. FIXME: BasicCallGraph is the only thing that inherits from CallGraph. Can we merge the two? llvm-svn: 193412 --- llvm/lib/Analysis/IPA/CallGraph.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'llvm/lib/Analysis/IPA') diff --git a/llvm/lib/Analysis/IPA/CallGraph.cpp b/llvm/lib/Analysis/IPA/CallGraph.cpp index 7620fd9842c..6c18d0d1a64 100644 --- a/llvm/lib/Analysis/IPA/CallGraph.cpp +++ b/llvm/lib/Analysis/IPA/CallGraph.cpp @@ -46,12 +46,16 @@ public: ExternalCallingNode(0), CallsExternalNode(0) { initializeBasicCallGraphPass(*PassRegistry::getPassRegistry()); } + ~BasicCallGraph() { + destroy(); + } // runOnModule - Compute the call graph for the specified module. virtual bool runOnModule(Module &M) { CallGraph::initialize(M); ExternalCallingNode = getOrInsertFunction(0); + assert(!CallsExternalNode); CallsExternalNode = new CallGraphNode(0); Root = 0; -- cgit v1.2.3