aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/Path.cpp
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2021-10-04 16:48:07 +0300
committerMartin Storsjö <martin@martin.st>2021-10-13 22:55:14 +0300
commit2a4b1539e991f289ea62f74a03f3fc6aa49c9c1f (patch)
treeb7960220516138440f8359238b3f9c8834f72243 /llvm/lib/Support/Path.cpp
parentd9b9a7f4287019ad7fb5ae35523e81dee36c1b40 (diff)
downloadllvm-2a4b1539e991f289ea62f74a03f3fc6aa49c9c1f.zip
llvm-2a4b1539e991f289ea62f74a03f3fc6aa49c9c1f.tar.gz
llvm-2a4b1539e991f289ea62f74a03f3fc6aa49c9c1f.tar.bz2
[Support] [Path] Use std::replace instead of an explicit comparison loop. NFC.
After 8fc7a907b93a8e9eef96e872f8f926db3ebfe9b6, this loop does the same as a plain `std::replace`. Also clarify the comment about what this function does. Differential Revision: https://reviews.llvm.org/D111730
Diffstat (limited to 'llvm/lib/Support/Path.cpp')
-rw-r--r--llvm/lib/Support/Path.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/llvm/lib/Support/Path.cpp b/llvm/lib/Support/Path.cpp
index a724ba2..f770bcc 100644
--- a/llvm/lib/Support/Path.cpp
+++ b/llvm/lib/Support/Path.cpp
@@ -557,9 +557,7 @@ void native(SmallVectorImpl<char> &Path, Style style) {
Path = PathHome;
}
} else {
- for (auto PI = Path.begin(), PE = Path.end(); PI < PE; ++PI)
- if (*PI == '\\')
- *PI = '/';
+ std::replace(Path.begin(), Path.end(), '\\', '/');
}
}