diff options
author | Rui Ueyama <ruiu@google.com> | 2017-01-09 01:47:15 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2017-01-09 01:47:15 +0000 |
commit | 3e6490399e0ac56d25819470ed7e53017f25351e (patch) | |
tree | ae0c74ada8542888d7511cc3a571d0b38079e8c4 /llvm/lib/Support/Path.cpp | |
parent | ec1c75e059a9917651ca39b60d58d41c8e7aecc5 (diff) | |
download | bcm5719-llvm-3e6490399e0ac56d25819470ed7e53017f25351e.tar.gz bcm5719-llvm-3e6490399e0ac56d25819470ed7e53017f25351e.zip |
Define sys::path::convert_to_slash
This patch moves convertToUnixPathSeparator from LLD to LLVM.
Differential Revision: https://reviews.llvm.org/D28444
llvm-svn: 291414
Diffstat (limited to 'llvm/lib/Support/Path.cpp')
-rw-r--r-- | llvm/lib/Support/Path.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Support/Path.cpp b/llvm/lib/Support/Path.cpp index 0616d05aff5..4bb035eeccc 100644 --- a/llvm/lib/Support/Path.cpp +++ b/llvm/lib/Support/Path.cpp @@ -571,6 +571,16 @@ void native(SmallVectorImpl<char> &Path) { #endif } +std::string convert_to_slash(StringRef path) { +#ifdef LLVM_ON_WIN32 + std::string s = path.str(); + std::replace(s.begin(), s.end(), '\\', '/'); + return s; +#else + return path; +#endif +} + StringRef filename(StringRef path) { return *rbegin(path); } |