diff --git a/llvm/include/llvm/Support/Path.h b/llvm/include/llvm/Support/Path.h --- a/llvm/include/llvm/Support/Path.h +++ b/llvm/include/llvm/Support/Path.h @@ -212,7 +212,7 @@ /// 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. diff --git a/llvm/lib/Support/Path.cpp b/llvm/lib/Support/Path.cpp --- a/llvm/lib/Support/Path.cpp +++ b/llvm/lib/Support/Path.cpp @@ -557,9 +557,7 @@ Path = PathHome; } } else { - for (auto PI = Path.begin(), PE = Path.end(); PI < PE; ++PI) - if (*PI == '\\') - *PI = '/'; + std::replace(Path.begin(), Path.end(), '\\', '/'); } }