argument.
llvm-svn: 177301
private:
const Driver &D;
const llvm::Triple Triple;
+ const ArgList &Args;
/// The list of toolchain specific path prefixes to search for
/// files.
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.
///@{
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.
// 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())) {
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;
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;
}
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() {
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());
/// 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;
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);
}
-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)
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);
/// 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);
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);
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);
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);
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);
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);
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,
/// 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
/// {
/// 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;
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;
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,
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;
}
// -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)) {
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 {
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