forked from OSchip/llvm-project
[Support] [Path] Use std::replace instead of an explicit comparison loop. NFC.
After 8fc7a907b9
, 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
This commit is contained in:
parent
d9b9a7f428
commit
2a4b1539e9
|
@ -212,7 +212,7 @@ void append(SmallVectorImpl<char> &path, const_iterator begin,
|
|||
|
||||
/// Convert path to the native form. This is used to give paths to users and
|
||||
/// operating system calls in the platform's normal way. For example, on Windows
|
||||
/// all '/' are converted to '\'.
|
||||
/// all '/' are converted to '\'. On Unix, it converts all '\' to '/'.
|
||||
///
|
||||
/// @param path A path that is transformed to native format.
|
||||
/// @param result Holds the result of the transformation.
|
||||
|
|
|
@ -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(), '\\', '/');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue