[clang] 1d0b7b6 - [clang] Use a range-based for loop (NFC)
Kazu Hirata via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 21 21:16:03 PDT 2023
Author: Kazu Hirata
Date: 2023-09-21T21:15:57-07:00
New Revision: 1d0b7b6c8aed0b769f6cb41e09c4e62b618a7037
URL: https://github.com/llvm/llvm-project/commit/1d0b7b6c8aed0b769f6cb41e09c4e62b618a7037
DIFF: https://github.com/llvm/llvm-project/commit/1d0b7b6c8aed0b769f6cb41e09c4e62b618a7037.diff
LOG: [clang] Use a range-based for loop (NFC)
Added:
Modified:
clang/lib/Basic/Sarif.cpp
Removed:
################################################################################
diff --git a/clang/lib/Basic/Sarif.cpp b/clang/lib/Basic/Sarif.cpp
index e71f4b3337fcef4..bef948181ec014b 100644
--- a/clang/lib/Basic/Sarif.cpp
+++ b/clang/lib/Basic/Sarif.cpp
@@ -87,12 +87,12 @@ static std::string fileNameToURI(StringRef Filename) {
assert(Iter != End && "Expected there to be a non-root path component.");
// Add the rest of the path components, encoding any reserved characters;
// we skip past the first path component, as it was handled it above.
- std::for_each(++Iter, End, [&Ret](StringRef Component) {
+ for (StringRef Component : llvm::make_range(++Iter, End)) {
// For reasons unknown to me, we may get a backslash with Windows native
// paths for the initial backslash following the drive component, which
// we need to ignore as a URI path part.
if (Component == "\\")
- return;
+ continue;
// Add the separator between the previous path part and the one being
// currently processed.
@@ -102,7 +102,7 @@ static std::string fileNameToURI(StringRef Filename) {
for (char C : Component) {
Ret += percentEncodeURICharacter(C);
}
- });
+ }
return std::string(Ret);
}
More information about the cfe-commits
mailing list