diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index 7ebf6997e27ea7..d455bede6babca 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -7596,15 +7596,15 @@ static SourceRange nextPathEntryRange(const IndirectLocalPath &Path, unsigned I, } static bool pathOnlyInitializesGslPointer(IndirectLocalPath &Path) { - for (auto It = Path.rbegin(), End = Path.rend(); It != End; ++It) { - if (It->Kind == IndirectLocalPathEntry::VarInit) + for (const auto &It : llvm::reverse(Path)) { + if (It.Kind == IndirectLocalPathEntry::VarInit) continue; - if (It->Kind == IndirectLocalPathEntry::AddressOf) + if (It.Kind == IndirectLocalPathEntry::AddressOf) continue; - if (It->Kind == IndirectLocalPathEntry::LifetimeBoundCall) + if (It.Kind == IndirectLocalPathEntry::LifetimeBoundCall) continue; - return It->Kind == IndirectLocalPathEntry::GslPointerInit || - It->Kind == IndirectLocalPathEntry::GslReferenceInit; + return It.Kind == IndirectLocalPathEntry::GslPointerInit || + It.Kind == IndirectLocalPathEntry::GslReferenceInit; } return false; } diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 8708c4d49f8cff..05e6c6ea7952b0 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -8228,8 +8228,8 @@ namespace serialization { /// Add the given set of methods to the method list. static void addMethodsToPool(Sema &S, ArrayRef Methods, ObjCMethodList &List) { - for (auto I = Methods.rbegin(), E = Methods.rend(); I != E; ++I) - S.addMethodToGlobalList(&List, *I); + for (ObjCMethodDecl *M : llvm::reverse(Methods)) + S.addMethodToGlobalList(&List, M); } void ASTReader::ReadMethodPool(Selector Sel) {