[lld] r291414 - Define sys::path::convert_to_slash
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 8 17:47:16 PST 2017
Author: ruiu
Date: Sun Jan 8 19:47:15 2017
New Revision: 291414
URL: http://llvm.org/viewvc/llvm-project?rev=291414&view=rev
Log:
Define sys::path::convert_to_slash
This patch moves convertToUnixPathSeparator from LLD to LLVM.
Differential Revision: https://reviews.llvm.org/D28444
Modified:
lld/trunk/include/lld/Core/Reproduce.h
lld/trunk/lib/Core/Reproduce.cpp
Modified: lld/trunk/include/lld/Core/Reproduce.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/Reproduce.h?rev=291414&r1=291413&r2=291414&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/Reproduce.h (original)
+++ lld/trunk/include/lld/Core/Reproduce.h Sun Jan 8 19:47:15 2017
@@ -34,9 +34,6 @@ std::string rewritePath(StringRef S);
// Returns the string form of the given argument.
std::string toString(llvm::opt::Arg *Arg);
-
-// Replaces backslashes with slashes if Windows.
-std::string convertToUnixPathSeparator(StringRef S);
}
#endif
Modified: lld/trunk/lib/Core/Reproduce.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/Reproduce.cpp?rev=291414&r1=291413&r2=291414&view=diff
==============================================================================
--- lld/trunk/lib/Core/Reproduce.cpp (original)
+++ lld/trunk/lib/Core/Reproduce.cpp Sun Jan 8 19:47:15 2017
@@ -39,7 +39,7 @@ std::string lld::relativeToRoot(StringRe
Res = Root.substr(2);
path::append(Res, path::relative_path(Abs));
- return convertToUnixPathSeparator(Res);
+ return path::convert_to_slash(Res);
}
// Quote a given string if it contains a space character.
@@ -64,13 +64,3 @@ 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
-}
More information about the llvm-commits
mailing list