diff --git a/llvm/lib/IR/LegacyPassManager.cpp b/llvm/lib/IR/LegacyPassManager.cpp index a0793d01b3c6..03391ce1749a 100644 --- a/llvm/lib/IR/LegacyPassManager.cpp +++ b/llvm/lib/IR/LegacyPassManager.cpp @@ -531,9 +531,8 @@ PMTopLevelManager::setLastUser(ArrayRef AnalysisPasses, Pass *P) { const AnalysisUsage::VectorType &IDs = AnUsage->getRequiredTransitiveSet(); SmallVector LastUses; SmallVector LastPMUses; - for (AnalysisUsage::VectorType::const_iterator I = IDs.begin(), - E = IDs.end(); I != E; ++I) { - Pass *AnalysisPass = findAnalysisPass(*I); + for (AnalysisID ID : IDs) { + Pass *AnalysisPass = findAnalysisPass(ID); assert(AnalysisPass && "Expected analysis pass to exist."); AnalysisResolver *AR = AnalysisPass->getResolver(); assert(AR && "Expected analysis resolver to exist."); @@ -791,29 +790,24 @@ void PMTopLevelManager::dumpArguments() const { return; dbgs() << "Pass Arguments: "; - for (SmallVectorImpl::const_iterator I = - ImmutablePasses.begin(), E = ImmutablePasses.end(); I != E; ++I) - if (const PassInfo *PI = findAnalysisPassInfo((*I)->getPassID())) { + for (ImmutablePass *P : ImmutablePasses) + if (const PassInfo *PI = findAnalysisPassInfo(P->getPassID())) { assert(PI && "Expected all immutable passes to be initialized"); if (!PI->isAnalysisGroup()) dbgs() << " -" << PI->getPassArgument(); } - for (SmallVectorImpl::const_iterator I = - PassManagers.begin(), E = PassManagers.end(); I != E; ++I) - (*I)->dumpPassArguments(); + for (PMDataManager *PM : PassManagers) + PM->dumpPassArguments(); dbgs() << "\n"; } void PMTopLevelManager::initializeAllAnalysisInfo() { - for (SmallVectorImpl::iterator I = PassManagers.begin(), - E = PassManagers.end(); I != E; ++I) - (*I)->initializeAnalysisInfo(); + for (PMDataManager *PM : PassManagers) + PM->initializeAnalysisInfo(); // Initailize other pass managers - for (SmallVectorImpl::iterator - I = IndirectPassManagers.begin(), E = IndirectPassManagers.end(); - I != E; ++I) - (*I)->initializeAnalysisInfo(); + for (PMDataManager *IPM : IndirectPassManagers) + IPM->initializeAnalysisInfo(); for (DenseMap::iterator DMI = LastUser.begin(), DME = LastUser.end(); DMI != DME; ++DMI) { @@ -824,13 +818,11 @@ void PMTopLevelManager::initializeAllAnalysisInfo() { /// Destructor PMTopLevelManager::~PMTopLevelManager() { - for (SmallVectorImpl::iterator I = PassManagers.begin(), - E = PassManagers.end(); I != E; ++I) - delete *I; + for (PMDataManager *PM : PassManagers) + delete PM; - for (SmallVectorImpl::iterator - I = ImmutablePasses.begin(), E = ImmutablePasses.end(); I != E; ++I) - delete *I; + for (ImmutablePass *P : ImmutablePasses) + delete P; } //===----------------------------------------------------------------------===//