[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp

Devang Patel dpatel at apple.com
Tue Dec 12 16:09:43 PST 2006



Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.90 -> 1.91
---
Log message:

Implement PassManager_New destructors.


---
Diffs of the changes:  (+27 -2)

 PassManager.cpp |   29 +++++++++++++++++++++++++++--
 1 files changed, 27 insertions(+), 2 deletions(-)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.90 llvm/lib/VMCore/PassManager.cpp:1.91
--- llvm/lib/VMCore/PassManager.cpp:1.90	Tue Dec 12 17:51:31 2006
+++ llvm/lib/VMCore/PassManager.cpp	Tue Dec 12 18:09:23 2006
@@ -126,6 +126,15 @@
   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 @@
     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 @@
   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 @@
 
 //===----------------------------------------------------------------------===//
 // 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 @@
   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






More information about the llvm-commits mailing list