Skip to content

Commit 1d0b7b6

Browse files
[clang] Use a range-based for loop (NFC)
1 parent a15fbf0 commit 1d0b7b6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

clang/lib/Basic/Sarif.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@ static std::string fileNameToURI(StringRef Filename) {
8787
assert(Iter != End && "Expected there to be a non-root path component.");
8888
// Add the rest of the path components, encoding any reserved characters;
8989
// we skip past the first path component, as it was handled it above.
90-
std::for_each(++Iter, End, [&Ret](StringRef Component) {
90+
for (StringRef Component : llvm::make_range(++Iter, End)) {
9191
// For reasons unknown to me, we may get a backslash with Windows native
9292
// paths for the initial backslash following the drive component, which
9393
// we need to ignore as a URI path part.
9494
if (Component == "\\")
95-
return;
95+
continue;
9696

9797
// Add the separator between the previous path part and the one being
9898
// currently processed.
@@ -102,7 +102,7 @@ static std::string fileNameToURI(StringRef Filename) {
102102
for (char C : Component) {
103103
Ret += percentEncodeURICharacter(C);
104104
}
105-
});
105+
}
106106

107107
return std::string(Ret);
108108
}

0 commit comments

Comments
 (0)