[clang] 9418634 - [clang] Use llvm::reverse (NFC)
Kazu Hirata via cfe-commits
cfe-commits at lists.llvm.org
Sun Nov 6 21:09:26 PST 2022
Author: Kazu Hirata
Date: 2022-11-06T21:09:20-08:00
New Revision: 94186347a10b4bd945edaa21cfc025685e9490d7
URL: https://github.com/llvm/llvm-project/commit/94186347a10b4bd945edaa21cfc025685e9490d7
DIFF: https://github.com/llvm/llvm-project/commit/94186347a10b4bd945edaa21cfc025685e9490d7.diff
LOG: [clang] Use llvm::reverse (NFC)
Added:
Modified:
clang/lib/Sema/SemaInit.cpp
clang/lib/Serialization/ASTReader.cpp
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index 7ebf6997e27ea..d455bede6babc 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 8708c4d49f8cf..05e6c6ea7952b 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<ObjCMethodDecl *> 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) {
More information about the cfe-commits
mailing list