Skip to content

Commit

Permalink
Document that PassManager::add() may delete the pass right away.
Browse files Browse the repository at this point in the history
Also remove redundant documentation:
- doxygen will copy documentation to overriden methods.
- Use \copydoc on PIMPL classes instead of replicating the text.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224089 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
MatzeB committed Dec 12, 2014
1 parent c010032 commit e821037
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 27 deletions.
12 changes: 2 additions & 10 deletions include/llvm/IR/LegacyPassManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand All @@ -51,10 +52,6 @@ class PassManager : public PassManagerBase {
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
Expand All @@ -75,11 +72,6 @@ class FunctionPassManager : public PassManagerBase {
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
Expand Down
19 changes: 2 additions & 17 deletions lib/IR/LegacyPassManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,7 @@ class FunctionPassManagerImpl : public Pass,
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);
}
Expand Down Expand Up @@ -398,10 +395,7 @@ class PassManagerImpl : public Pass,
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);
}
Expand Down Expand Up @@ -1389,11 +1383,6 @@ FunctionPassManager::~FunctionPassManager() {
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);
}
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit e821037

Please sign in to comment.