aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2006-12-13 00:09:23 +0000
committerDevang Patel <dpatel@apple.com>2006-12-13 00:09:23 +0000
commit37a6f7966c39f69a92419d37949a94a758c29e90 (patch)
tree6a996e4961ca5d3e2d4b1ecedaabadec24728ab9
parentd4ea4ef541354f9b27b3526399dd3970a2a5064e (diff)
Implement PassManager_New destructors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32517 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/PassManager.h3
-rw-r--r--lib/VMCore/PassManager.cpp29
2 files changed, 29 insertions, 3 deletions
diff --git a/include/llvm/PassManager.h b/include/llvm/PassManager.h
index cd8e70b1b3..81c7fd6222 100644
--- a/include/llvm/PassManager.h
+++ b/include/llvm/PassManager.h
@@ -97,6 +97,7 @@ class PassManager_New {
public:
PassManager_New();
+ ~PassManager_New();
/// add - Add a pass to the queue of passes to run. This passes ownership of
/// the Pass to the PassManager. When the PassManager is destroyed, the pass
@@ -121,7 +122,7 @@ class FunctionPassManager_New {
public:
FunctionPassManager_New(ModuleProvider *P);
FunctionPassManager_New();
- ~FunctionPassManager_New() { /* TODO */ };
+ ~FunctionPassManager_New();
/// add - Add a pass to the queue of passes to run. This passes
/// ownership of the Pass to the PassManager. When the
diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp
index 5a3def3316..e6f69c07a6 100644
--- a/lib/VMCore/PassManager.cpp
+++ b/lib/VMCore/PassManager.cpp
@@ -126,6 +126,15 @@ public:
Pass *findAnalysisPass(AnalysisID AID);
virtual ~PMTopLevelManager() {
+
+ for (std::vector<Pass *>::iterator I = PassManagers.begin(),
+ E = PassManagers.end(); I != E; ++I)
+ delete *I;
+
+ for (std::vector<ImmutablePass *>::iterator
+ I = ImmutablePasses.begin(), E = ImmutablePasses.end(); I != E; ++I)
+ delete *I;
+
PassManagers.clear();
}
@@ -182,6 +191,15 @@ public:
initializeAnalysisInfo();
}
+ virtual ~PMDataManager() {
+
+ for (std::vector<Pass *>::iterator I = PassVector.begin(),
+ E = PassVector.end(); I != E; ++I)
+ delete *I;
+
+ PassVector.clear();
+ }
+
/// Return true IFF pass P's required analysis set does not required new
/// manager.
bool manageablePass(Pass *P);
@@ -914,6 +932,10 @@ FunctionPassManager_New::FunctionPassManager_New(ModuleProvider *P) {
MP = P;
}
+FunctionPassManager_New::~FunctionPassManager_New() {
+ delete FPM;
+}
+
/// add - Add a pass to the queue of passes to run. This passes
/// ownership of the Pass to the PassManager. When the
/// PassManager_X is destroyed, the pass will be destroyed as well, so
@@ -1187,8 +1209,7 @@ ModulePassManager_New::runOnModule(Module &M) {
//===----------------------------------------------------------------------===//
// PassManagerImpl implementation
-
-// PassManager_New implementation
+//
/// Add P into active pass manager or use new module pass manager to
/// manage it.
bool PassManagerImpl_New::addPass(Pass *P) {
@@ -1232,6 +1253,10 @@ PassManager_New::PassManager_New() {
PM->setTopLevelManager(PM);
}
+PassManager_New::~PassManager_New() {
+ delete PM;
+}
+
/// add - Add a pass to the queue of passes to run. This passes ownership of
/// the Pass to the PassManager. When the PassManager is destroyed, the pass
/// will be destroyed as well, so there is no need to delete the pass. This