summaryrefslogtreecommitdiff
path: root/lib/IR/LegacyPassManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/IR/LegacyPassManager.cpp')
-rw-r--r--lib/IR/LegacyPassManager.cpp33
1 files changed, 7 insertions, 26 deletions
diff --git a/lib/IR/LegacyPassManager.cpp b/lib/IR/LegacyPassManager.cpp
index d3f3482dc024..b9ab25651fa2 100644
--- a/lib/IR/LegacyPassManager.cpp
+++ b/lib/IR/LegacyPassManager.cpp
@@ -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);
}
@@ -573,9 +567,8 @@ void PMTopLevelManager::collectLastUses(SmallVectorImpl<Pass *> &LastUses,
return;
SmallPtrSet<Pass *, 8> &LU = DMI->second;
- for (SmallPtrSet<Pass *, 8>::iterator I = LU.begin(),
- E = LU.end(); I != E; ++I) {
- LastUses.push_back(*I);
+ for (Pass *LUP : LU) {
+ LastUses.push_back(LUP);
}
}
@@ -1390,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);
}
@@ -1404,11 +1392,8 @@ void FunctionPassManager::add(Pass *P) {
/// so, return true.
///
bool FunctionPassManager::run(Function &F) {
- if (F.isMaterializable()) {
- std::string errstr;
- if (F.Materialize(&errstr))
- report_fatal_error("Error reading bitcode file: " + Twine(errstr));
- }
+ if (std::error_code EC = F.materialize())
+ report_fatal_error("Error reading bitcode file: " + EC.message());
return FPM->run(F);
}
@@ -1684,7 +1669,7 @@ void MPPassManager::addLowerLevelRequiredPass(Pass *P, Pass *RequiredPass) {
if (!FoundPass) {
FoundPass = RequiredPass;
// This should be guaranteed to add RequiredPass to the passmanager given
- // that we checked for an avaiable analysis above.
+ // that we checked for an available analysis above.
FPP->add(RequiredPass);
}
// Register P as the last user of FoundPass or RequiredPass.
@@ -1753,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);
}