зеркало из https://github.com/microsoft/clang-1.git
Pass an ArgList to every toolchain constructor. Remove the useIntegratedAs
argument. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177301 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
7ce8d82c41
Коммит
af370e6e05
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче