[llvm] r193412 - Call destroy from ~BasicCallGraph.
Rafael Espindola
rafael.espindola at gmail.com
Fri Oct 25 08:01:35 PDT 2013
Author: rafael
Date: Fri Oct 25 10:01:34 2013
New Revision: 193412
URL: http://llvm.org/viewvc/llvm-project?rev=193412&view=rev
Log:
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?
Modified:
llvm/trunk/include/llvm/Analysis/CallGraph.h
llvm/trunk/lib/Analysis/IPA/CallGraph.cpp
Modified: llvm/trunk/include/llvm/Analysis/CallGraph.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/CallGraph.h?rev=193412&r1=193411&r2=193412&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/CallGraph.h (original)
+++ llvm/trunk/include/llvm/Analysis/CallGraph.h Fri Oct 25 10:01:34 2013
@@ -152,7 +152,7 @@ protected:
CallGraph() {}
public:
- virtual ~CallGraph() { destroy(); }
+ virtual ~CallGraph() { }
/// initialize - Call this method before calling other methods,
/// re/initializes the state of the CallGraph.
Modified: llvm/trunk/lib/Analysis/IPA/CallGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraph.cpp?rev=193412&r1=193411&r2=193412&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/IPA/CallGraph.cpp (original)
+++ llvm/trunk/lib/Analysis/IPA/CallGraph.cpp Fri Oct 25 10:01:34 2013
@@ -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;
More information about the llvm-commits
mailing list