summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/tools/clang/lib/Driver
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/tools/clang/lib/Driver')
-rw-r--r--contrib/llvm/tools/clang/lib/Driver/Compilation.cpp4
-rw-r--r--contrib/llvm/tools/clang/lib/Driver/Driver.cpp52
-rw-r--r--contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp17
-rw-r--r--contrib/llvm/tools/clang/lib/Driver/Tools.cpp10
4 files changed, 42 insertions, 41 deletions
diff --git a/contrib/llvm/tools/clang/lib/Driver/Compilation.cpp b/contrib/llvm/tools/clang/lib/Driver/Compilation.cpp
index 42c8449..5553fc9 100644
--- a/contrib/llvm/tools/clang/lib/Driver/Compilation.cpp
+++ b/contrib/llvm/tools/clang/lib/Driver/Compilation.cpp
@@ -230,3 +230,7 @@ void Compilation::initCompilationForDiagnostics(void) {
Redirects[1] = new const llvm::sys::Path();
Redirects[2] = new const llvm::sys::Path();
}
+
+StringRef Compilation::getSysRoot(void) const {
+ return getDriver().SysRoot;
+}
diff --git a/contrib/llvm/tools/clang/lib/Driver/Driver.cpp b/contrib/llvm/tools/clang/lib/Driver/Driver.cpp
index 40e0c00..bb78a41 100644
--- a/contrib/llvm/tools/clang/lib/Driver/Driver.cpp
+++ b/contrib/llvm/tools/clang/lib/Driver/Driver.cpp
@@ -49,8 +49,8 @@ Driver::Driver(StringRef ClangExecutable,
bool IsProduction,
DiagnosticsEngine &Diags)
: Opts(createDriverOptTable()), Diags(Diags),
- ClangExecutable(ClangExecutable), UseStdLib(true),
- DefaultTargetTriple(DefaultTargetTriple),
+ ClangExecutable(ClangExecutable), SysRoot(DEFAULT_SYSROOT),
+ UseStdLib(true), DefaultTargetTriple(DefaultTargetTriple),
DefaultImageName(DefaultImageName),
DriverTitle("clang \"gcc-compatible\" driver"),
CCPrintOptionsFilename(0), CCPrintHeadersFilename(0),
@@ -660,9 +660,7 @@ bool Driver::HandleImmediateArgs(const Compilation &C) {
llvm::outs() << "\n";
llvm::outs() << "libraries: =" << ResourceDir;
- std::string sysroot;
- if (Arg *A = C.getArgs().getLastArg(options::OPT__sysroot_EQ))
- sysroot = A->getValue(C.getArgs());
+ StringRef sysroot = C.getSysRoot();
for (ToolChain::path_list::const_iterator it = TC.getFilePaths().begin(),
ie = TC.getFilePaths().end(); it != ie; ++it) {
@@ -872,30 +870,30 @@ void Driver::BuildUniversalActions(const ToolChain &TC,
// Handle debug info queries.
Arg *A = Args.getLastArg(options::OPT_g_Group);
- if (A && !A->getOption().matches(options::OPT_g0) &&
- !A->getOption().matches(options::OPT_gstabs) &&
- ContainsCompileOrAssembleAction(Actions.back())) {
-
- // Add a 'dsymutil' step if necessary, when debug info is enabled and we
- // have a compile input. We need to run 'dsymutil' ourselves in such cases
- // because the debug info will refer to a temporary object file which is
- // will be removed at the end of the compilation process.
- if (Act->getType() == types::TY_Image) {
- ActionList Inputs;
- Inputs.push_back(Actions.back());
- Actions.pop_back();
- Actions.push_back(new DsymutilJobAction(Inputs, types::TY_dSYM));
- }
+ if (A && !A->getOption().matches(options::OPT_g0) &&
+ !A->getOption().matches(options::OPT_gstabs) &&
+ ContainsCompileOrAssembleAction(Actions.back())) {
+
+ // Add a 'dsymutil' step if necessary, when debug info is enabled and we
+ // have a compile input. We need to run 'dsymutil' ourselves in such cases
+ // because the debug info will refer to a temporary object file which is
+ // will be removed at the end of the compilation process.
+ if (Act->getType() == types::TY_Image) {
+ ActionList Inputs;
+ Inputs.push_back(Actions.back());
+ Actions.pop_back();
+ Actions.push_back(new DsymutilJobAction(Inputs, types::TY_dSYM));
+ }
- // Verify the output (debug information only) if we passed '-verify'.
- if (Args.hasArg(options::OPT_verify)) {
- ActionList VerifyInputs;
- VerifyInputs.push_back(Actions.back());
- Actions.pop_back();
- Actions.push_back(new VerifyJobAction(VerifyInputs,
- types::TY_Nothing));
- }
+ // Verify the output (debug information only) if we passed '-verify'.
+ if (Args.hasArg(options::OPT_verify)) {
+ ActionList VerifyInputs;
+ VerifyInputs.push_back(Actions.back());
+ Actions.pop_back();
+ Actions.push_back(new VerifyJobAction(VerifyInputs,
+ types::TY_Nothing));
}
+ }
}
}
diff --git a/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp b/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp
index fa9ed49..81657d8 100644
--- a/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp
+++ b/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp
@@ -35,10 +35,6 @@
#include "clang/Config/config.h" // for GCC_INSTALL_PREFIX
-#ifndef CLANG_PREFIX
-#define CLANG_PREFIX
-#endif
-
using namespace clang::driver;
using namespace clang::driver::toolchains;
using namespace clang;
@@ -584,7 +580,7 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) const {
// If no '-miphoneos-version-min' specified on the command line and
// IPHONEOS_DEPLOYMENT_TARGET is not defined, see if we can set the default
- // based on isysroot.
+ // based on -isysroot.
if (iOSTarget.empty()) {
if (const Arg *A = Args.getLastArg(options::OPT_isysroot)) {
StringRef first, second;
@@ -1090,6 +1086,7 @@ bool Generic_GCC::GCCVersion::operator<(const GCCVersion &RHS) const {
// a patch.
if (RHS.Patch == -1) return true; if (Patch == -1) return false;
if (Patch < RHS.Patch) return true; if (Patch > RHS.Patch) return false;
+ if (PatchSuffix == RHS.PatchSuffix) return false;
// Finally, between completely tied version numbers, the version with the
// suffix loses as we prefer full releases.
@@ -1107,7 +1104,7 @@ static StringRef getGCCToolchainDir(const ArgList &Args) {
/// \brief Construct a GCCInstallationDetector from the driver.
///
/// This performs all of the autodetection and sets up the various paths.
-/// Once constructed, a GCCInstallation is esentially immutable.
+/// Once constructed, a GCCInstallationDetector is essentially immutable.
///
/// FIXME: We shouldn't need an explicit TargetTriple parameter here, and
/// should instead pull the target out of the driver. This is currently
@@ -1618,10 +1615,10 @@ FreeBSD::FreeBSD(const Driver &D, const llvm::Triple& Triple, const ArgList &Arg
// back to '/usr/lib' if it doesn't exist.
if ((Triple.getArch() == llvm::Triple::x86 ||
Triple.getArch() == llvm::Triple::ppc) &&
- llvm::sys::fs::exists(getDriver().SysRoot + CLANG_PREFIX "/usr/lib32/crt1.o"))
- getFilePaths().push_back(getDriver().SysRoot + CLANG_PREFIX "/usr/lib32");
+ llvm::sys::fs::exists(getDriver().SysRoot + "/usr/lib32/crt1.o"))
+ getFilePaths().push_back(getDriver().SysRoot + "/usr/lib32");
else
- getFilePaths().push_back(getDriver().SysRoot + CLANG_PREFIX "/usr/lib");
+ getFilePaths().push_back(getDriver().SysRoot + "/usr/lib");
}
Tool &FreeBSD::SelectTool(const Compilation &C, const JobAction &JA,
@@ -2067,7 +2064,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
// If the GCC installation we found is inside of the sysroot, we want to
// prefer libraries installed in the parent prefix of the GCC installation.
// It is important to *not* use these paths when the GCC installation is
- // outside of the system root as that can pick up un-intented libraries.
+ // outside of the system root as that can pick up unintended libraries.
// This usually happens when there is an external cross compiler on the
// host system, and a more minimal sysroot available that is the target of
// the cross.
diff --git a/contrib/llvm/tools/clang/lib/Driver/Tools.cpp b/contrib/llvm/tools/clang/lib/Driver/Tools.cpp
index d3dab19..04fa8a1 100644
--- a/contrib/llvm/tools/clang/lib/Driver/Tools.cpp
+++ b/contrib/llvm/tools/clang/lib/Driver/Tools.cpp
@@ -377,10 +377,11 @@ void Clang::AddPreprocessingOptions(Compilation &C,
// If we have a --sysroot, and don't have an explicit -isysroot flag, add an
// -isysroot to the CC1 invocation.
- if (Arg *A = Args.getLastArg(options::OPT__sysroot_EQ)) {
+ StringRef sysroot = C.getSysRoot();
+ if (sysroot != "") {
if (!Args.hasArg(options::OPT_isysroot)) {
CmdArgs.push_back("-isysroot");
- CmdArgs.push_back(A->getValue(Args));
+ CmdArgs.push_back(C.getArgs().MakeArgString(sysroot));
}
}
@@ -4017,9 +4018,10 @@ void darwin::Link::AddLinkArgs(Compilation &C,
// Give --sysroot= preference, over the Apple specific behavior to also use
// --isysroot as the syslibroot.
- if (const Arg *A = Args.getLastArg(options::OPT__sysroot_EQ)) {
+ StringRef sysroot = C.getSysRoot();
+ if (sysroot != "") {
CmdArgs.push_back("-syslibroot");
- CmdArgs.push_back(A->getValue(Args));
+ CmdArgs.push_back(C.getArgs().MakeArgString(sysroot));
} else if (const Arg *A = Args.getLastArg(options::OPT_isysroot)) {
CmdArgs.push_back("-syslibroot");
CmdArgs.push_back(A->getValue(Args));
OpenPOWER on IntegriCloud