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 &BasicBlock : *Fn) { + llvm::Instruction *T = BasicBlock.getTerminator(); if (isa(T)) { RValue RV = RValue::get(T->getOperand(0)); T->eraseFromParent(); - Builder.SetInsertPoint(&*I); + Builder.SetInsertPoint(&BasicBlock); 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); }