[llvm] r187722 - Don't leak passes if added outside of the area determined by Started/Stopped flags.
Benjamin Kramer
benny.kra at googlemail.com
Mon Aug 5 04:11:11 PDT 2013
Author: d0k
Date: Mon Aug 5 06:11:11 2013
New Revision: 187722
URL: http://llvm.org/viewvc/llvm-project?rev=187722&view=rev
Log:
Don't leak passes if added outside of the area determined by Started/Stopped flags.
Modified:
llvm/trunk/include/llvm/CodeGen/Passes.h
llvm/trunk/lib/CodeGen/Passes.cpp
Modified: llvm/trunk/include/llvm/CodeGen/Passes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/Passes.h?rev=187722&r1=187721&r2=187722&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/Passes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/Passes.h Mon Aug 5 06:11:11 2013
@@ -308,7 +308,8 @@ protected:
AnalysisID addPass(AnalysisID PassID);
/// Add a pass to the PassManager if that pass is supposed to be run, as
- /// determined by the StartAfter and StopAfter options.
+ /// determined by the StartAfter and StopAfter options. Takes ownership of the
+ /// pass.
void addPass(Pass *P);
/// addMachinePasses helper to create the target-selected or overriden
Modified: llvm/trunk/lib/CodeGen/Passes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/Passes.cpp?rev=187722&r1=187721&r2=187722&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/Passes.cpp (original)
+++ llvm/trunk/lib/CodeGen/Passes.cpp Mon Aug 5 06:11:11 2013
@@ -300,6 +300,8 @@ void TargetPassConfig::addPass(Pass *P)
if (Started && !Stopped)
PM->add(P);
+ else
+ delete P;
if (StopAfter == PassID)
Stopped = true;
if (StartAfter == PassID)
More information about the llvm-commits
mailing list