Index: lib/CodeGen/CGVTables.cpp =================================================================== --- lib/CodeGen/CGVTables.cpp +++ lib/CodeGen/CGVTables.cpp @@ -187,12 +187,12 @@ if (!Thunk.Return.isEmpty()) { // Fix up the returned value, if necessary. - for (llvm::Function::iterator I = Fn->begin(), E = Fn->end(); I != E; I++) { - llvm::Instruction *T = I->getTerminator(); + for (auto &BBlock : *Fn) { + llvm::Instruction *T = BBlock.getTerminator(); if (isa(T)) { RValue RV = RValue::get(T->getOperand(0)); T->eraseFromParent(); - Builder.SetInsertPoint(&*I); + Builder.SetInsertPoint(&BBlock); RV = PerformReturnAdjustment(*this, ResultType, RV, Thunk); Builder.CreateRet(RV.getScalarVal()); break; @@ -832,10 +832,7 @@ size_t savedSize = DeferredVTables.size(); #endif - typedef std::vector::const_iterator const_iterator; - for (const_iterator i = DeferredVTables.begin(), - e = DeferredVTables.end(); i != e; ++i) { - const CXXRecordDecl *RD = *i; + for (const auto &RD : DeferredVTables) { if (shouldEmitVTableAtEndOfTranslationUnit(*this, RD)) VTables.GenerateClassData(RD); } Index: lib/CodeGen/ItaniumCXXABI.cpp =================================================================== --- lib/CodeGen/ItaniumCXXABI.cpp +++ lib/CodeGen/ItaniumCXXABI.cpp @@ -1023,25 +1023,25 @@ CharUnits Offset; // Now walk all possible inheritance paths. - for (CXXBasePaths::paths_iterator I = Paths.begin(), E = Paths.end(); I != E; - ++I) { - if (I->Access != AS_public) // Ignore non-public inheritance. + for (auto &Path : Paths) { + if (Path.Access != AS_public) // Ignore non-public inheritance. continue; ++NumPublicPaths; - for (CXXBasePath::iterator J = I->begin(), JE = I->end(); J != JE; ++J) { + for (auto &PathElement : Path) { // If the path contains a virtual base class we can't give any hint. // -1: no hint. - if (J->Base->isVirtual()) + if (PathElement.Base->isVirtual()) return CharUnits::fromQuantity(-1ULL); if (NumPublicPaths > 1) // Won't use offsets, skip computation. continue; // Accumulate the base class offsets. - const ASTRecordLayout &L = Context.getASTRecordLayout(J->Class); - Offset += L.getBaseClassOffset(J->Base->getType()->getAsCXXRecordDecl()); + const ASTRecordLayout &L = Context.getASTRecordLayout(PathElement.Class); + Offset += L.getBaseClassOffset( + PathElement.Base->getType()->getAsCXXRecordDecl()); } }