diff options
Diffstat (limited to 'lld/lib/Core/Reproduce.cpp')
-rw-r--r-- | lld/lib/Core/Reproduce.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lld/lib/Core/Reproduce.cpp b/lld/lib/Core/Reproduce.cpp index 58bf2bda5a8..ab7261fa0e7 100644 --- a/lld/lib/Core/Reproduce.cpp +++ b/lld/lib/Core/Reproduce.cpp @@ -39,7 +39,7 @@ std::string lld::relativeToRoot(StringRef Path) { Res = Root.substr(2); path::append(Res, path::relative_path(Abs)); - return Res.str(); + return convertToUnixPathSeparator(Res); } // Quote a given string if it contains a space character. @@ -64,3 +64,13 @@ std::string lld::toString(opt::Arg *Arg) { return K + V; return K + " " + V; } + +std::string lld::convertToUnixPathSeparator(StringRef S) { +#ifdef LLVM_ON_WIN32 + std::string Ret = S.str(); + std::replace(Ret.begin(), Ret.end(), '\\', '/'); + return Ret; +#else + return S; +#endif +} |