r345372 - Revert "Reapply: [Driver] Use forward slashes in most linker arguments"
Martin Storsjo via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 26 01:33:29 PDT 2018
Author: mstorsjo
Date: Fri Oct 26 01:33:29 2018
New Revision: 345372
URL: http://llvm.org/viewvc/llvm-project?rev=345372&view=rev
Log:
Revert "Reapply: [Driver] Use forward slashes in most linker arguments"
This reverts commit r345370, as it uncovered even more issues in
tests with partial/inconsistent path normalization:
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/13562
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/886
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/20994
In particular, these tests seem to have failed:
Clang :: CodeGen/thinlto-diagnostic-handler-remarks-with-hotness.ll
Clang :: CodeGen/thinlto-multi-module.ll
Clang :: Driver/cuda-external-tools.cu
Clang :: Driver/cuda-options.cu
Clang :: Driver/hip-toolchain-no-rdc.hip
Clang :: Driver/hip-toolchain-rdc.hip
Clang :: Driver/openmp-offload-gpu.c
At least the Driver tests could potentially be fixed by extending
the path normalization to even more places, but the issues with the
CodeGen tests are still unknown.
In addition, a number of other tests seem to have been broken in
other clang dependent tools such as clang-tidy and clangd.
Modified:
cfe/trunk/include/clang/Driver/ToolChain.h
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
Modified: cfe/trunk/include/clang/Driver/ToolChain.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=345372&r1=345371&r2=345372&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/ToolChain.h (original)
+++ cfe/trunk/include/clang/Driver/ToolChain.h Fri Oct 26 01:33:29 2018
@@ -21,7 +21,6 @@
#include "llvm/ADT/Triple.h"
#include "llvm/MC/MCTargetOptions.h"
#include "llvm/Option/Option.h"
-#include "llvm/Support/Path.h"
#include "llvm/Support/VersionTuple.h"
#include "llvm/Target/TargetOptions.h"
#include <cassert>
@@ -371,12 +370,6 @@ public:
StringRef Component,
bool Shared = false) const;
- std::string normalizePath(StringRef Path) const {
- if (!Triple.isOSWindows() || Triple.isOSCygMing())
- return llvm::sys::path::convert_to_slash(Path);
- return Path;
- }
-
// Returns <ResourceDir>/lib/<OSName>/<arch>. This is used by runtimes (such
// as OpenMP) to find arch-specific libraries.
std::string getArchSpecificLibPath() const;
Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=345372&r1=345371&r2=345372&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Fri Oct 26 01:33:29 2018
@@ -1011,12 +1011,6 @@ Compilation *Driver::BuildCompilation(Ar
.Default(SaveTempsCwd);
}
- llvm::Triple EffectiveTriple = computeTargetTriple(*this, TargetTriple, Args);
- if (!EffectiveTriple.isOSWindows() || EffectiveTriple.isOSCygMing()) {
- for (auto *Str : {&Dir, &InstalledDir, &SysRoot, &ResourceDir})
- *Str = llvm::sys::path::convert_to_slash(*Str);
- }
-
setLTOMode(Args);
// Process -fembed-bitcode= flags.
Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=345372&r1=345371&r2=345372&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Fri Oct 26 01:33:29 2018
@@ -376,10 +376,9 @@ std::string ToolChain::getCompilerRT(con
for (const auto &LibPath : getLibraryPaths()) {
SmallString<128> P(LibPath);
- llvm::sys::path::append(P,
- Prefix + Twine("clang_rt.") + Component + Suffix);
+ llvm::sys::path::append(P, Prefix + Twine("clang_rt.") + Component + Suffix);
if (getVFS().exists(P))
- return normalizePath(P);
+ return P.str();
}
StringRef Arch = getArchNameForCompilerRTLib(*this, Args);
@@ -387,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 normalizePath(Path);
+ return Path.str();
}
const char *ToolChain::getCompilerRTArgString(const llvm::opt::ArgList &Args,
@@ -426,7 +425,7 @@ Tool *ToolChain::SelectTool(const JobAct
}
std::string ToolChain::GetFilePath(const char *Name) const {
- return normalizePath(D.GetFilePath(Name, *this));
+ return D.GetFilePath(Name, *this);
}
std::string ToolChain::GetProgramPath(const char *Name) const {
@@ -775,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") + normalizePath(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") + normalizePath(LibPath)));
+ if(LibPath.length() > 0)
+ CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
}
void ToolChain::AddCCKextLibArgs(const ArgList &Args,
Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=345372&r1=345371&r2=345372&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Fri Oct 26 01:33:29 2018
@@ -3570,8 +3570,7 @@ void Clang::ConstructJob(Compilation &C,
for (const auto &II : Inputs) {
addDashXForInput(Args, II, CmdArgs);
if (II.isFilename())
- CmdArgs.push_back(
- Args.MakeArgString(TC.normalizePath(II.getFilename())));
+ CmdArgs.push_back(II.getFilename());
else
II.getInputArg().renderAsInput(Args, CmdArgs);
}
@@ -4964,8 +4963,7 @@ void Clang::ConstructJob(Compilation &C,
// Handled with other dependency code.
} else if (Output.isFilename()) {
CmdArgs.push_back("-o");
- CmdArgs.push_back(
- Args.MakeArgString(TC.normalizePath(Output.getFilename())));
+ CmdArgs.push_back(Output.getFilename());
} else {
assert(Output.isNothing() && "Invalid output.");
}
@@ -4980,8 +4978,7 @@ void Clang::ConstructJob(Compilation &C,
for (const InputInfo &Input : FrontendInputs) {
if (Input.isFilename())
- CmdArgs.push_back(
- Args.MakeArgString(TC.normalizePath(Input.getFilename())));
+ CmdArgs.push_back(Input.getFilename());
else
Input.getInputArg().renderAsInput(Args, CmdArgs);
}
@@ -5674,10 +5671,9 @@ void ClangAs::ConstructJob(Compilation &
assert(Inputs.size() == 1 && "Unexpected number of inputs.");
const InputInfo &Input = Inputs[0];
- const ToolChain &TC = getToolChain();
- const llvm::Triple &Triple = TC.getEffectiveTriple();
+ const llvm::Triple &Triple = getToolChain().getEffectiveTriple();
const std::string &TripleStr = Triple.getTriple();
- const auto &D = TC.getDriver();
+ const auto &D = getToolChain().getDriver();
// Don't warn about "clang -w -c foo.s"
Args.ClaimAllArgs(options::OPT_w);
@@ -5851,7 +5847,7 @@ void ClangAs::ConstructJob(Compilation &
assert(Output.isFilename() && "Unexpected lipo output.");
CmdArgs.push_back("-o");
- CmdArgs.push_back(Args.MakeArgString(TC.normalizePath(Output.getFilename())));
+ CmdArgs.push_back(Output.getFilename());
const llvm::Triple &T = getToolChain().getTriple();
if (Args.hasArg(options::OPT_gsplit_dwarf) &&
@@ -5861,7 +5857,7 @@ void ClangAs::ConstructJob(Compilation &
}
assert(Input.isFilename() && "Invalid input.");
- CmdArgs.push_back(Args.MakeArgString(TC.normalizePath(Input.getFilename())));
+ CmdArgs.push_back(Input.getFilename());
const char *Exec = getToolChain().getDriver().getClangProgramPath();
C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs));
Modified: cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp?rev=345372&r1=345371&r2=345372&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp Fri Oct 26 01:33:29 2018
@@ -163,7 +163,7 @@ void tools::AddLinkerInputs(const ToolCh
// Add filenames immediately.
if (II.isFilename()) {
- CmdArgs.push_back(Args.MakeArgString(TC.normalizePath(II.getFilename())));
+ CmdArgs.push_back(II.getFilename());
continue;
}
Modified: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Gnu.cpp?rev=345372&r1=345371&r2=345372&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Gnu.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Gnu.cpp Fri Oct 26 01:33:29 2018
@@ -1699,7 +1699,7 @@ void Generic_GCC::GCCInstallationDetecto
if (GCCToolchainDir.back() == '/')
GCCToolchainDir = GCCToolchainDir.drop_back(); // remove the /
- Prefixes.push_back(llvm::sys::path::convert_to_slash(GCCToolchainDir));
+ Prefixes.push_back(GCCToolchainDir);
} else {
// If we have a SysRoot, try that first.
if (!D.SysRoot.empty()) {
More information about the cfe-commits
mailing list