r345005 - Revert "[Driver] Use forward slashes in most linker arguments"

Martin Storsjo via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 23 00:01:55 PDT 2018


Author: mstorsjo
Date: Tue Oct 23 00:01:55 2018
New Revision: 345005

URL: http://llvm.org/viewvc/llvm-project?rev=345005&view=rev
Log:
Revert "[Driver] Use forward slashes in most linker arguments"

This reverts commit r345004, as it broke tests when actually run
on windows; see e.g.
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/763.

This broke tests that had captured a variable containing a path
with backslashes, which failed to match cases in the output
where the path separators had been changed into forward slashes.

Modified:
    cfe/trunk/lib/Driver/ToolChain.cpp

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=345005&r1=345004&r2=345005&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Tue Oct 23 00:01:55 2018
@@ -378,7 +378,7 @@ std::string ToolChain::getCompilerRT(con
     SmallString<128> P(LibPath);
     llvm::sys::path::append(P, Prefix + Twine("clang_rt.") + Component + Suffix);
     if (getVFS().exists(P))
-      return llvm::sys::path::convert_to_slash(P);
+      return P.str();
   }
 
   StringRef Arch = getArchNameForCompilerRTLib(*this, Args);
@@ -386,7 +386,7 @@ std::string ToolChain::getCompilerRT(con
   SmallString<128> Path(getCompilerRTPath());
   llvm::sys::path::append(Path, Prefix + Twine("clang_rt.") + Component + "-" +
                                     Arch + Env + Suffix);
-  return llvm::sys::path::convert_to_slash(Path);
+  return Path.str();
 }
 
 const char *ToolChain::getCompilerRTArgString(const llvm::opt::ArgList &Args,
@@ -425,7 +425,7 @@ Tool *ToolChain::SelectTool(const JobAct
 }
 
 std::string ToolChain::GetFilePath(const char *Name) const {
-  return llvm::sys::path::convert_to_slash(D.GetFilePath(Name, *this));
+  return D.GetFilePath(Name, *this);
 }
 
 std::string ToolChain::GetProgramPath(const char *Name) const {
@@ -774,14 +774,12 @@ void ToolChain::AddCXXStdlibLibArgs(cons
 void ToolChain::AddFilePathLibArgs(const ArgList &Args,
                                    ArgStringList &CmdArgs) const {
   for (const auto &LibPath : getLibraryPaths())
-    if (LibPath.length() > 0)
-      CmdArgs.push_back(Args.MakeArgString(
-          StringRef("-L") + llvm::sys::path::convert_to_slash(LibPath)));
+    if(LibPath.length() > 0)
+      CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
 
   for (const auto &LibPath : getFilePaths())
-    if (LibPath.length() > 0)
-      CmdArgs.push_back(Args.MakeArgString(
-          StringRef("-L") + llvm::sys::path::convert_to_slash(LibPath)));
+    if(LibPath.length() > 0)
+      CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
 }
 
 void ToolChain::AddCCKextLibArgs(const ArgList &Args,




More information about the cfe-commits mailing list