aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/Driver/ToolChain.h5
-rw-r--r--lib/Driver/Driver.cpp8
-rw-r--r--lib/Driver/ToolChain.cpp7
-rw-r--r--lib/Driver/ToolChains.cpp28
-rw-r--r--lib/Driver/ToolChains.h9
-rw-r--r--lib/Driver/Tools.cpp6
-rw-r--r--lib/Driver/WindowsToolChain.cpp7
7 files changed, 38 insertions, 32 deletions
diff --git a/include/clang/Driver/ToolChain.h b/include/clang/Driver/ToolChain.h
index 32b739dc63..78ca4d2df6 100644
--- a/include/clang/Driver/ToolChain.h
+++ b/include/clang/Driver/ToolChain.h
@@ -47,6 +47,7 @@ public:
private:
const Driver &D;
const llvm::Triple Triple;
+ const ArgList &Args;
/// The list of toolchain specific path prefixes to search for
/// files.
@@ -57,7 +58,7 @@ private:
path_list ProgramPaths;
protected:
- ToolChain(const Driver &D, const llvm::Triple &T);
+ ToolChain(const Driver &D, const llvm::Triple &T, const ArgList &Args);
/// \name Utilities for implementing subclasses.
///@{
@@ -138,7 +139,7 @@ public:
virtual bool IsIntegratedAssemblerDefault() const { return false; }
/// \brief Check if the toolchain should use the integrated assembler.
- bool useIntegratedAs(const ArgList &Args) const;
+ bool useIntegratedAs() const;
/// IsStrictAliasingDefault - Does this tool chain use -fstrict-aliasing by
/// default.
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
index bd48b4845e..d250cb031f 100644
--- a/lib/Driver/Driver.cpp
+++ b/lib/Driver/Driver.cpp
@@ -1296,7 +1296,7 @@ static const Tool &SelectToolForJob(Compilation &C, const ToolChain *TC,
// bottom up, so what we are actually looking for is an assembler job with a
// compiler input.
- if (TC->useIntegratedAs(C.getArgs()) &&
+ if (TC->useIntegratedAs() &&
!C.getArgs().hasArg(options::OPT_save_temps) &&
isa<AssembleJobAction>(JA) &&
Inputs->size() == 1 && isa<CompileJobAction>(*Inputs->begin())) {
@@ -1687,7 +1687,7 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
Target.getArch() == llvm::Triple::x86_64 ||
Target.getArch() == llvm::Triple::arm ||
Target.getArch() == llvm::Triple::thumb)
- TC = new toolchains::DarwinClang(*this, Target);
+ TC = new toolchains::DarwinClang(*this, Target, Args);
else
TC = new toolchains::Darwin_Generic_GCC(*this, Target, Args);
break;
@@ -1719,14 +1719,14 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
TC = new toolchains::Solaris(*this, Target, Args);
break;
case llvm::Triple::Win32:
- TC = new toolchains::Windows(*this, Target);
+ TC = new toolchains::Windows(*this, Target, Args);
break;
case llvm::Triple::MinGW32:
// FIXME: We need a MinGW toolchain. Fallthrough for now.
default:
// TCE is an OSless target
if (Target.getArchName() == "tce") {
- TC = new toolchains::TCEToolChain(*this, Target);
+ TC = new toolchains::TCEToolChain(*this, Target, Args);
break;
}
diff --git a/lib/Driver/ToolChain.cpp b/lib/Driver/ToolChain.cpp
index 29aecf2e2c..83c16462e2 100644
--- a/lib/Driver/ToolChain.cpp
+++ b/lib/Driver/ToolChain.cpp
@@ -21,8 +21,9 @@
using namespace clang::driver;
using namespace clang;
-ToolChain::ToolChain(const Driver &D, const llvm::Triple &T)
- : D(D), Triple(T) {
+ToolChain::ToolChain(const Driver &D, const llvm::Triple &T,
+ const ArgList &A)
+ : D(D), Triple(T), Args(A) {
}
ToolChain::~ToolChain() {
@@ -32,7 +33,7 @@ const Driver &ToolChain::getDriver() const {
return D;
}
-bool ToolChain::useIntegratedAs(const ArgList &Args) const {
+bool ToolChain::useIntegratedAs() const {
return Args.hasFlag(options::OPT_integrated_as,
options::OPT_no_integrated_as,
IsIntegratedAssemblerDefault());
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index 5b8f5c9806..d9ecb2ed20 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -42,8 +42,8 @@ using namespace clang;
/// Darwin - Darwin tool chain for i386 and x86_64.
-Darwin::Darwin(const Driver &D, const llvm::Triple& Triple)
- : ToolChain(D, Triple), TargetInitialized(false)
+Darwin::Darwin(const Driver &D, const llvm::Triple& Triple, const ArgList &Args)
+ : ToolChain(D, Triple, Args), TargetInitialized(false)
{
// Compute the initial Darwin version from the triple
unsigned Major, Minor, Micro;
@@ -197,7 +197,7 @@ Tool &Darwin::SelectTool(const Compilation &C, const JobAction &JA) const {
case Action::CompileJobClass:
T = new tools::Clang(*this); break;
case Action::AssembleJobClass: {
- if (useIntegratedAs(C.getArgs()))
+ if (useIntegratedAs())
T = new tools::ClangAs(*this);
else
T = new tools::darwin::Assemble(*this);
@@ -218,8 +218,9 @@ Tool &Darwin::SelectTool(const Compilation &C, const JobAction &JA) const {
}
-DarwinClang::DarwinClang(const Driver &D, const llvm::Triple& Triple)
- : Darwin(D, Triple)
+DarwinClang::DarwinClang(const Driver &D, const llvm::Triple& Triple,
+ const ArgList &Args)
+ : Darwin(D, Triple, Args)
{
getProgramPaths().push_back(getDriver().getInstalledDir());
if (getDriver().getInstalledDir() != getDriver().Dir)
@@ -1368,7 +1369,7 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple(
Generic_GCC::Generic_GCC(const Driver &D, const llvm::Triple& Triple,
const ArgList &Args)
- : ToolChain(D, Triple), GCCInstallation(getDriver(), Triple, Args) {
+ : ToolChain(D, Triple, Args), GCCInstallation(getDriver(), Triple, Args) {
getProgramPaths().push_back(getDriver().getInstalledDir());
if (getDriver().getInstalledDir() != getDriver().Dir)
getProgramPaths().push_back(getDriver().Dir);
@@ -1668,8 +1669,9 @@ StringRef Hexagon_TC::GetTargetCPU(const ArgList &Args)
/// all subcommands. See http://tce.cs.tut.fi for our peculiar target.
/// Currently does not support anything else but compilation.
-TCEToolChain::TCEToolChain(const Driver &D, const llvm::Triple& Triple)
- : ToolChain(D, Triple) {
+TCEToolChain::TCEToolChain(const Driver &D, const llvm::Triple& Triple,
+ const ArgList &Args)
+ : ToolChain(D, Triple, Args) {
// Path mangling to find libexec
std::string Path(getDriver().Dir);
@@ -1733,7 +1735,7 @@ Tool &OpenBSD::SelectTool(const Compilation &C, const JobAction &JA) const {
if (!T) {
switch (Key) {
case Action::AssembleJobClass: {
- if (useIntegratedAs(C.getArgs()))
+ if (useIntegratedAs())
T = new tools::ClangAs(*this);
else
T = new tools::openbsd::Assemble(*this);
@@ -1768,7 +1770,7 @@ Tool &Bitrig::SelectTool(const Compilation &C, const JobAction &JA) const {
if (!T) {
switch (Key) {
case Action::AssembleJobClass: {
- if (useIntegratedAs(C.getArgs()))
+ if (useIntegratedAs())
T = new tools::ClangAs(*this);
else
T = new tools::bitrig::Assemble(*this);
@@ -1855,7 +1857,7 @@ Tool &FreeBSD::SelectTool(const Compilation &C, const JobAction &JA) const {
if (!T) {
switch (Key) {
case Action::AssembleJobClass:
- if (useIntegratedAs(C.getArgs()))
+ if (useIntegratedAs())
T = new tools::ClangAs(*this);
else
T = new tools::freebsd::Assemble(*this);
@@ -1912,7 +1914,7 @@ Tool &NetBSD::SelectTool(const Compilation &C, const JobAction &JA) const {
if (!T) {
switch (Key) {
case Action::AssembleJobClass:
- if (useIntegratedAs(C.getArgs()))
+ if (useIntegratedAs())
T = new tools::ClangAs(*this);
else
T = new tools::netbsd::Assemble(*this);
@@ -2411,7 +2413,7 @@ Tool &Linux::SelectTool(const Compilation &C, const JobAction &JA) const {
if (!T) {
switch (Key) {
case Action::AssembleJobClass:
- if (useIntegratedAs(C.getArgs()))
+ if (useIntegratedAs())
T = new tools::ClangAs(*this);
else
T = new tools::linuxtools::Assemble(*this);
diff --git a/lib/Driver/ToolChains.h b/lib/Driver/ToolChains.h
index ce2556f818..a2b4f2f46e 100644
--- a/lib/Driver/ToolChains.h
+++ b/lib/Driver/ToolChains.h
@@ -180,7 +180,7 @@ private:
void AddDeploymentTarget(DerivedArgList &Args) const;
public:
- Darwin(const Driver &D, const llvm::Triple& Triple);
+ Darwin(const Driver &D, const llvm::Triple& Triple, const ArgList &Args);
~Darwin();
std::string ComputeEffectiveClangTriple(const ArgList &Args,
@@ -340,7 +340,7 @@ public:
/// DarwinClang - The Darwin toolchain used by Clang.
class LLVM_LIBRARY_VISIBILITY DarwinClang : public Darwin {
public:
- DarwinClang(const Driver &D, const llvm::Triple& Triple);
+ DarwinClang(const Driver &D, const llvm::Triple& Triple, const ArgList &Args);
/// @name Darwin ToolChain Implementation
/// {
@@ -530,7 +530,8 @@ public:
/// all subcommands. See http://tce.cs.tut.fi for our peculiar target.
class LLVM_LIBRARY_VISIBILITY TCEToolChain : public ToolChain {
public:
- TCEToolChain(const Driver &D, const llvm::Triple& Triple);
+ TCEToolChain(const Driver &D, const llvm::Triple& Triple,
+ const ArgList &Args);
~TCEToolChain();
virtual Tool &SelectTool(const Compilation &C, const JobAction &JA) const;
@@ -547,7 +548,7 @@ class LLVM_LIBRARY_VISIBILITY Windows : public ToolChain {
mutable llvm::DenseMap<unsigned, Tool*> Tools;
public:
- Windows(const Driver &D, const llvm::Triple& Triple);
+ Windows(const Driver &D, const llvm::Triple& Triple, const ArgList &Args);
virtual Tool &SelectTool(const Compilation &C, const JobAction &JA) const;
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index a53e9f8147..97aa3155b9 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -1420,7 +1420,7 @@ static bool ShouldDisableCFI(const ArgList &Args,
if (TC.getTriple().isOSDarwin()) {
// The native darwin assembler doesn't support cfi directives, so
// we disable them if we think the .s file will be passed to it.
- Default = TC.useIntegratedAs(Args);
+ Default = TC.useIntegratedAs();
}
return !Args.hasFlag(options::OPT_fdwarf2_cfi_asm,
options::OPT_fno_dwarf2_cfi_asm,
@@ -1431,7 +1431,7 @@ static bool ShouldDisableDwarfDirectory(const ArgList &Args,
const ToolChain &TC) {
bool UseDwarfDirectory = Args.hasFlag(options::OPT_fdwarf_directory_asm,
options::OPT_fno_dwarf_directory_asm,
- TC.useIntegratedAs(Args));
+ TC.useIntegratedAs());
return !UseDwarfDirectory;
}
@@ -2806,7 +2806,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
// -fmodules-autolink (on by default when modules is enabled) automatically
// links against libraries for imported modules. This requires the
// integrated assembler.
- if (HaveModules && getToolChain().useIntegratedAs(Args) &&
+ if (HaveModules && getToolChain().useIntegratedAs() &&
Args.hasFlag(options::OPT_fmodules_autolink,
options::OPT_fno_modules_autolink,
true)) {
diff --git a/lib/Driver/WindowsToolChain.cpp b/lib/Driver/WindowsToolChain.cpp
index a0a71a7d42..df4d72e091 100644
--- a/lib/Driver/WindowsToolChain.cpp
+++ b/lib/Driver/WindowsToolChain.cpp
@@ -31,8 +31,9 @@ using namespace clang::driver;
using namespace clang::driver::toolchains;
using namespace clang;
-Windows::Windows(const Driver &D, const llvm::Triple& Triple)
- : ToolChain(D, Triple) {
+Windows::Windows(const Driver &D, const llvm::Triple& Triple,
+ const ArgList &Args)
+ : ToolChain(D, Triple, Args) {
}
Tool &Windows::SelectTool(const Compilation &C, const JobAction &JA) const {
@@ -57,7 +58,7 @@ Tool &Windows::SelectTool(const Compilation &C, const JobAction &JA) const {
case Action::CompileJobClass:
T = new tools::Clang(*this); break;
case Action::AssembleJobClass:
- if (!useIntegratedAs(C.getArgs()) &&
+ if (!useIntegratedAs() &&
getTriple().getEnvironment() == llvm::Triple::MachO)
T = new tools::darwin::Assemble(*this);
else