[llvm] r224089 - Document that PassManager::add() may delete the pass right away.

Matthias Braun matze at braunis.de
Thu Dec 11 17:27:02 PST 2014


Author: matze
Date: Thu Dec 11 19:27:01 2014
New Revision: 224089

URL: http://llvm.org/viewvc/llvm-project?rev=224089&view=rev
Log:
Document that PassManager::add() may delete the pass right away.

Also remove redundant documentation:
- doxygen will copy documentation to overriden methods.
- Use \copydoc on PIMPL classes instead of replicating the text.

Modified:
    llvm/trunk/include/llvm/IR/LegacyPassManager.h
    llvm/trunk/lib/IR/LegacyPassManager.cpp

Modified: llvm/trunk/include/llvm/IR/LegacyPassManager.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/LegacyPassManager.h?rev=224089&r1=224088&r2=224089&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/LegacyPassManager.h (original)
+++ llvm/trunk/include/llvm/IR/LegacyPassManager.h Thu Dec 11 19:27:01 2014
@@ -37,9 +37,10 @@ class PassManagerBase {
 public:
   virtual ~PassManagerBase();
 
-  /// add - Add a pass to the queue of passes to run.  This passes ownership of
+  /// 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
+  /// may even destroy the pass right away if it is found to be redundant. This
   /// implies that all passes MUST be allocated with 'new'.
   virtual void add(Pass *P) = 0;
 };
@@ -51,10 +52,6 @@ public:
   PassManager();
   ~PassManager();
 
-  /// 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
-  /// implies that all passes MUST be allocated with 'new'.
   void add(Pass *P) override;
 
   /// run - Execute all of the passes scheduled for execution.  Keep track of
@@ -75,11 +72,6 @@ public:
   explicit FunctionPassManager(Module *M);
   ~FunctionPassManager();
 
-  /// 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
-  /// there is no need to delete the pass.
-  /// This implies that all passes MUST be allocated with 'new'.
   void add(Pass *P) override;
 
   /// run - Execute all of the passes scheduled for execution.  Keep

Modified: llvm/trunk/lib/IR/LegacyPassManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/LegacyPassManager.cpp?rev=224089&r1=224088&r2=224089&view=diff
==============================================================================
--- llvm/trunk/lib/IR/LegacyPassManager.cpp (original)
+++ llvm/trunk/lib/IR/LegacyPassManager.cpp Thu Dec 11 19:27:01 2014
@@ -227,10 +227,7 @@ public:
     Pass(PT_PassManager, ID), PMDataManager(),
     PMTopLevelManager(new FPPassManager()), wasRun(false) {}
 
-  /// 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
-  /// implies that all passes MUST be allocated with 'new'.
+  /// \copydoc FunctionPassManager::add()
   void add(Pass *P) {
     schedulePass(P);
   }
@@ -398,10 +395,7 @@ public:
     Pass(PT_PassManager, ID), PMDataManager(),
                               PMTopLevelManager(new MPPassManager()) {}
 
-  /// 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
-  /// implies that all passes MUST be allocated with 'new'.
+  /// \copydoc PassManager::add()
   void add(Pass *P) {
     schedulePass(P);
   }
@@ -1389,11 +1383,6 @@ FunctionPassManager::~FunctionPassManage
   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
-/// there is no need to delete the pass. (TODO delete passes.)
-/// This implies that all passes MUST be allocated with 'new'.
 void FunctionPassManager::add(Pass *P) {
   FPM->add(P);
 }
@@ -1749,10 +1738,6 @@ PassManager::~PassManager() {
   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
-/// implies that all passes MUST be allocated with 'new'.
 void PassManager::add(Pass *P) {
   PM->add(P);
 }





More information about the llvm-commits mailing list