2009-03-18 09:00:36 +03:00
|
|
|
//===--- Tools.cpp - Tools Implementations ------------------------------*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "Tools.h"
|
|
|
|
|
2009-03-18 13:01:51 +03:00
|
|
|
#include "clang/Driver/Action.h"
|
2009-03-18 10:06:02 +03:00
|
|
|
#include "clang/Driver/Arg.h"
|
2009-03-18 11:07:30 +03:00
|
|
|
#include "clang/Driver/ArgList.h"
|
2009-03-18 13:01:51 +03:00
|
|
|
#include "clang/Driver/Driver.h" // FIXME: Remove?
|
|
|
|
#include "clang/Driver/DriverDiagnostic.h" // FIXME: Remove?
|
2009-03-18 10:06:02 +03:00
|
|
|
#include "clang/Driver/Compilation.h"
|
|
|
|
#include "clang/Driver/Job.h"
|
2009-03-18 11:07:30 +03:00
|
|
|
#include "clang/Driver/HostInfo.h"
|
|
|
|
#include "clang/Driver/Option.h"
|
|
|
|
#include "clang/Driver/ToolChain.h"
|
2009-03-18 10:06:02 +03:00
|
|
|
#include "clang/Driver/Util.h"
|
|
|
|
|
|
|
|
#include "llvm/ADT/SmallVector.h"
|
|
|
|
|
|
|
|
#include "InputInfo.h"
|
|
|
|
|
2009-03-18 09:00:36 +03:00
|
|
|
using namespace clang::driver;
|
|
|
|
using namespace clang::driver::tools;
|
|
|
|
|
|
|
|
void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
2009-03-18 10:06:02 +03:00
|
|
|
Job &Dest,
|
|
|
|
const InputInfo &Output,
|
2009-03-18 09:07:59 +03:00
|
|
|
const InputInfoList &Inputs,
|
2009-03-18 13:01:51 +03:00
|
|
|
const ArgList &Args,
|
2009-03-18 09:00:36 +03:00
|
|
|
const char *LinkingOutput) const {
|
2009-03-18 11:07:30 +03:00
|
|
|
ArgStringList CmdArgs;
|
|
|
|
|
2009-03-18 13:01:51 +03:00
|
|
|
if (isa<AnalyzeJobAction>(JA)) {
|
|
|
|
assert(JA.getType() == types::TY_Plist && "Invalid output type.");
|
|
|
|
CmdArgs.push_back("-analyze");
|
|
|
|
} else if (isa<PreprocessJobAction>(JA)) {
|
|
|
|
CmdArgs.push_back("-E");
|
|
|
|
} else if (isa<PrecompileJobAction>(JA)) {
|
|
|
|
// No special option needed, driven by -x.
|
|
|
|
//
|
|
|
|
// FIXME: Don't drive this by -x, that is gross.
|
|
|
|
|
|
|
|
// FIXME: This is a total hack. Copy the input header file
|
|
|
|
// to the output, so that it can be -include'd by clang.
|
|
|
|
assert(Inputs.size() == 1 && "Cannot make PCH with multiple inputs.");
|
2009-03-19 10:29:38 +03:00
|
|
|
assert(Output.isFilename() && "Unexpected output");
|
2009-03-18 13:01:51 +03:00
|
|
|
assert(!Inputs[0].isPipe() && "Unexpected pipe");
|
2009-03-19 10:29:38 +03:00
|
|
|
assert(Inputs[0].isFilename() && "Unexpected input");
|
|
|
|
const char *InputPath = Inputs[0].getFilename();
|
|
|
|
llvm::sys::Path OutputPath(Output.getFilename());
|
2009-03-18 13:01:51 +03:00
|
|
|
OutputPath.eraseComponent();
|
|
|
|
if (OutputPath.empty())
|
|
|
|
OutputPath = llvm::sys::Path(InputPath).getLast();
|
2009-03-18 11:07:30 +03:00
|
|
|
else
|
2009-03-18 13:01:51 +03:00
|
|
|
OutputPath.appendComponent(llvm::sys::Path(InputPath).getLast());
|
|
|
|
if (!OutputPath.exists()) {
|
|
|
|
ArgStringList CpArgs;
|
|
|
|
CpArgs.push_back(InputPath);
|
|
|
|
CpArgs.push_back(Args.MakeArgString(OutputPath.c_str()));
|
2009-03-19 02:34:15 +03:00
|
|
|
const char *Exec =
|
|
|
|
Args.MakeArgString(getToolChain().GetProgramPath(C, "cp").c_str());
|
|
|
|
C.getJobs().addJob(new Command(Exec, CpArgs));
|
2009-03-18 13:01:51 +03:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
assert(isa<CompileJobAction>(JA) && "Invalid action for clang tool.");
|
|
|
|
|
|
|
|
if (JA.getType() == types::TY_Nothing) {
|
|
|
|
CmdArgs.push_back("-fsyntax-only");
|
|
|
|
} else if (JA.getType() == types::TY_LLVMAsm) {
|
|
|
|
CmdArgs.push_back("-emit-llvm");
|
|
|
|
} else if (JA.getType() == types::TY_LLVMBC) {
|
|
|
|
CmdArgs.push_back("-emit-llvm-bc");
|
|
|
|
} else if (JA.getType() == types::TY_PP_Asm) {
|
|
|
|
CmdArgs.push_back("-S");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// The make clang go fast button.
|
|
|
|
CmdArgs.push_back("-disable-free");
|
|
|
|
|
|
|
|
if (isa<AnalyzeJobAction>(JA)) {
|
|
|
|
// Add default argument set.
|
|
|
|
//
|
|
|
|
// FIXME: Move into clang?
|
|
|
|
CmdArgs.push_back("-warn-dead-stores");
|
|
|
|
CmdArgs.push_back("-checker-cfref");
|
|
|
|
CmdArgs.push_back("-warn-objc-methodsigs");
|
|
|
|
// Do not enable the missing -dealloc check.
|
|
|
|
// '-warn-objc-missing-dealloc',
|
|
|
|
CmdArgs.push_back("-warn-objc-unused-ivars");
|
|
|
|
|
|
|
|
CmdArgs.push_back("-analyzer-output=plist");
|
|
|
|
|
|
|
|
// Add -Xanalyzer arguments when running as analyzer.
|
|
|
|
Args.AddAllArgValues(CmdArgs, options::OPT_Xanalyzer);
|
|
|
|
} else {
|
|
|
|
// Perform argument translation for LLVM backend. This
|
|
|
|
// takes some care in reconciling with llvm-gcc. The
|
|
|
|
// issue is that llvm-gcc translates these options based on
|
|
|
|
// the values in cc1, whereas we are processing based on
|
|
|
|
// the driver arguments.
|
|
|
|
//
|
|
|
|
// FIXME: This is currently broken for -f flags when -fno
|
|
|
|
// variants are present.
|
|
|
|
|
|
|
|
// This comes from the default translation the driver + cc1
|
|
|
|
// would do to enable flag_pic.
|
|
|
|
//
|
|
|
|
// FIXME: Centralize this code.
|
|
|
|
bool PICEnabled = (Args.hasArg(options::OPT_fPIC) ||
|
|
|
|
Args.hasArg(options::OPT_fpic) ||
|
|
|
|
Args.hasArg(options::OPT_fPIE) ||
|
|
|
|
Args.hasArg(options::OPT_fpie));
|
|
|
|
bool PICDisabled = (Args.hasArg(options::OPT_mkernel) ||
|
|
|
|
Args.hasArg(options::OPT_static));
|
|
|
|
const char *Model = getToolChain().GetForcedPicModel();
|
|
|
|
if (!Model) {
|
|
|
|
if (Args.hasArg(options::OPT_mdynamic_no_pic))
|
|
|
|
Model = "dynamic-no-pic";
|
|
|
|
else if (PICDisabled)
|
|
|
|
Model = "static";
|
|
|
|
else if (PICEnabled)
|
|
|
|
Model = "pic";
|
|
|
|
else
|
|
|
|
Model = getToolChain().GetDefaultRelocationModel();
|
|
|
|
}
|
|
|
|
CmdArgs.push_back("--relocation-model");
|
|
|
|
CmdArgs.push_back(Model);
|
|
|
|
|
|
|
|
if (Args.hasArg(options::OPT_ftime_report))
|
|
|
|
CmdArgs.push_back("--time-passes");
|
|
|
|
// FIXME: Set --enable-unsafe-fp-math.
|
|
|
|
if (!Args.hasArg(options::OPT_fomit_frame_pointer))
|
|
|
|
CmdArgs.push_back("--disable-fp-elim");
|
|
|
|
if (!Args.hasFlag(options::OPT_fzero_initialized_in_bss,
|
|
|
|
options::OPT_fno_zero_initialized_in_bss,
|
|
|
|
true))
|
|
|
|
CmdArgs.push_back("--nozero-initialized-in-bss");
|
|
|
|
if (Args.hasArg(options::OPT_dA))
|
|
|
|
CmdArgs.push_back("--asm-verbose");
|
|
|
|
if (Args.hasArg(options::OPT_fdebug_pass_structure))
|
|
|
|
CmdArgs.push_back("--debug-pass=Structure");
|
|
|
|
if (Args.hasArg(options::OPT_fdebug_pass_arguments))
|
|
|
|
CmdArgs.push_back("--debug-pass=Arguments");
|
|
|
|
// FIXME: set --inline-threshhold=50 if (optimize_size || optimize
|
|
|
|
// < 3)
|
|
|
|
if (Args.hasFlag(options::OPT_funwind_tables,
|
|
|
|
options::OPT_fno_unwind_tables,
|
|
|
|
getToolChain().IsUnwindTablesDefault()))
|
|
|
|
CmdArgs.push_back("--unwind-tables=1");
|
|
|
|
else
|
|
|
|
CmdArgs.push_back("--unwind-tables=0");
|
|
|
|
if (!Args.hasFlag(options::OPT_mred_zone,
|
|
|
|
options::OPT_mno_red_zone,
|
|
|
|
true))
|
|
|
|
CmdArgs.push_back("--disable-red-zone");
|
|
|
|
if (Args.hasFlag(options::OPT_msoft_float,
|
|
|
|
options::OPT_mno_soft_float,
|
|
|
|
false))
|
|
|
|
CmdArgs.push_back("--soft-float");
|
|
|
|
|
|
|
|
// FIXME: Need target hooks.
|
|
|
|
if (memcmp(getToolChain().getPlatform().c_str(), "darwin", 6) == 0) {
|
|
|
|
if (getToolChain().getArchName() == "x86_64")
|
|
|
|
CmdArgs.push_back("--mcpu=core2");
|
|
|
|
else if (getToolChain().getArchName() == "i386")
|
|
|
|
CmdArgs.push_back("--mcpu=yonah");
|
|
|
|
}
|
|
|
|
|
|
|
|
// FIXME: Ignores ordering. Also, we need to find a realistic
|
|
|
|
// solution for this.
|
|
|
|
static const struct {
|
|
|
|
options::ID Pos, Neg;
|
|
|
|
const char *Name;
|
|
|
|
} FeatureOptions[] = {
|
|
|
|
{ options::OPT_mmmx, options::OPT_mno_mmx, "mmx" },
|
|
|
|
{ options::OPT_msse, options::OPT_mno_sse, "sse" },
|
|
|
|
{ options::OPT_msse2, options::OPT_mno_sse2, "sse2" },
|
|
|
|
{ options::OPT_msse3, options::OPT_mno_sse3, "sse3" },
|
|
|
|
{ options::OPT_mssse3, options::OPT_mno_ssse3, "ssse3" },
|
|
|
|
{ options::OPT_msse41, options::OPT_mno_sse41, "sse41" },
|
|
|
|
{ options::OPT_msse42, options::OPT_mno_sse42, "sse42" },
|
|
|
|
{ options::OPT_msse4a, options::OPT_mno_sse4a, "sse4a" },
|
|
|
|
{ options::OPT_m3dnow, options::OPT_mno_3dnow, "3dnow" },
|
|
|
|
{ options::OPT_m3dnowa, options::OPT_mno_3dnowa, "3dnowa" }
|
|
|
|
};
|
|
|
|
const unsigned NumFeatureOptions =
|
|
|
|
sizeof(FeatureOptions)/sizeof(FeatureOptions[0]);
|
|
|
|
|
|
|
|
// FIXME: Avoid std::string
|
|
|
|
std::string Attrs;
|
|
|
|
for (unsigned i=0; i < NumFeatureOptions; ++i) {
|
|
|
|
if (Args.hasArg(FeatureOptions[i].Pos)) {
|
|
|
|
Attrs += '+';
|
|
|
|
Attrs += FeatureOptions[i].Name;
|
|
|
|
} else if (Args.hasArg(FeatureOptions[i].Neg)) {
|
|
|
|
Attrs += '-';
|
|
|
|
Attrs += FeatureOptions[i].Name;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!Attrs.empty()) {
|
|
|
|
CmdArgs.push_back("--mattr");
|
|
|
|
CmdArgs.push_back(Args.MakeArgString(Attrs.c_str()));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Args.hasFlag(options::OPT_fmath_errno,
|
|
|
|
options::OPT_fno_math_errno,
|
|
|
|
getToolChain().IsMathErrnoDefault()))
|
|
|
|
CmdArgs.push_back("--fmath-errno=1");
|
|
|
|
else
|
|
|
|
CmdArgs.push_back("--fmath-errno=0");
|
|
|
|
|
|
|
|
if (Arg *A = Args.getLastArg(options::OPT_flimited_precision_EQ)) {
|
|
|
|
CmdArgs.push_back("--limit-float-precision");
|
|
|
|
CmdArgs.push_back(A->getValue(Args));
|
|
|
|
}
|
|
|
|
|
|
|
|
// FIXME: Add --stack-protector-buffer-size=<xxx> on
|
|
|
|
// -fstack-protect.
|
|
|
|
|
|
|
|
Args.AddLastArg(CmdArgs, options::OPT_MD);
|
|
|
|
Args.AddLastArg(CmdArgs, options::OPT_MM);
|
|
|
|
Args.AddAllArgs(CmdArgs, options::OPT_MF);
|
|
|
|
Args.AddLastArg(CmdArgs, options::OPT_MP);
|
|
|
|
Args.AddAllArgs(CmdArgs, options::OPT_MT);
|
|
|
|
|
|
|
|
Arg *Unsupported = Args.getLastArg(options::OPT_M);
|
|
|
|
if (!Unsupported)
|
|
|
|
Unsupported = Args.getLastArg(options::OPT_MM);
|
|
|
|
if (!Unsupported)
|
|
|
|
Unsupported = Args.getLastArg(options::OPT_MG);
|
|
|
|
if (!Unsupported)
|
|
|
|
Unsupported = Args.getLastArg(options::OPT_MQ);
|
|
|
|
if (Unsupported) {
|
|
|
|
const Driver &D = getToolChain().getHost().getDriver();
|
|
|
|
D.Diag(clang::diag::err_drv_unsupported_opt)
|
|
|
|
<< Unsupported->getOption().getName();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Args.AddAllArgs(CmdArgs, options::OPT_v);
|
|
|
|
Args.AddAllArgs(CmdArgs, options::OPT_D, options::OPT_U);
|
|
|
|
Args.AddAllArgs(CmdArgs, options::OPT_I_Group, options::OPT_F);
|
|
|
|
Args.AddLastArg(CmdArgs, options::OPT_P);
|
|
|
|
Args.AddAllArgs(CmdArgs, options::OPT_mmacosx_version_min_EQ);
|
|
|
|
|
|
|
|
// Special case debug options to only pass -g to clang. This is
|
|
|
|
// wrong.
|
|
|
|
if (Args.hasArg(options::OPT_g_Group))
|
|
|
|
CmdArgs.push_back("-g");
|
|
|
|
|
|
|
|
Args.AddLastArg(CmdArgs, options::OPT_nostdinc);
|
|
|
|
|
|
|
|
// FIXME: Clang isn't going to accept just anything here.
|
|
|
|
Args.AddAllArgs(CmdArgs, options::OPT_i_Group);
|
|
|
|
|
|
|
|
// Automatically load .pth or .gch files which match -include
|
|
|
|
// options. It's wonky, but we include looking for .gch so we can
|
|
|
|
// support seamless replacement into a build system already set up
|
|
|
|
// to be generating .gch files.
|
|
|
|
|
|
|
|
// FIXME: Need to use an iterator for this to be efficient.
|
|
|
|
for (ArgList::const_iterator
|
|
|
|
it = Args.begin(), ie = Args.end(); it != ie; ++it) {
|
|
|
|
const Arg *A = *it;
|
|
|
|
if (A->getOption().matches(options::OPT_include)) {
|
|
|
|
llvm::sys::Path P(A->getValue(Args));
|
|
|
|
P.appendSuffix("pth");
|
|
|
|
if (P.exists()) {
|
|
|
|
CmdArgs.push_back("-token-cache");
|
|
|
|
CmdArgs.push_back(Args.MakeArgString(P.c_str()));
|
|
|
|
} else {
|
|
|
|
P.eraseSuffix();
|
|
|
|
P.appendSuffix("gch");
|
|
|
|
if (P.exists()) {
|
|
|
|
CmdArgs.push_back("-token-cache");
|
|
|
|
CmdArgs.push_back(Args.MakeArgString(P.c_str()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Manually translate -O to -O1; let clang reject others.
|
|
|
|
if (Arg *A = Args.getLastArg(options::OPT_O)) {
|
|
|
|
if (A->getValue(Args)[0] == '\0')
|
|
|
|
CmdArgs.push_back("-O1");
|
|
|
|
else
|
2009-03-19 02:39:35 +03:00
|
|
|
A->render(Args, CmdArgs);
|
2009-03-18 13:01:51 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
Args.AddAllArgs(CmdArgs, options::OPT_clang_W_Group, options::OPT_pedantic_Group);
|
|
|
|
Args.AddLastArg(CmdArgs, options::OPT_w);
|
|
|
|
Args.AddAllArgs(CmdArgs, options::OPT_std_EQ, options::OPT_ansi,
|
|
|
|
options::OPT_trigraphs);
|
|
|
|
|
|
|
|
if (Arg *A = Args.getLastArg(options::OPT_ftemplate_depth_)) {
|
|
|
|
CmdArgs.push_back("-ftemplate-depth");
|
|
|
|
CmdArgs.push_back(A->getValue(Args));
|
2009-03-18 11:07:30 +03:00
|
|
|
}
|
|
|
|
|
2009-03-18 13:01:51 +03:00
|
|
|
Args.AddAllArgs(CmdArgs, options::OPT_clang_f_Group);
|
|
|
|
|
|
|
|
Args.AddLastArg(CmdArgs, options::OPT_dM);
|
|
|
|
|
|
|
|
Args.AddAllArgValues(CmdArgs, options::OPT_Xclang);
|
|
|
|
|
|
|
|
// FIXME: Always pass the full triple once we aren't concerned with
|
|
|
|
// ccc compat.
|
|
|
|
CmdArgs.push_back("-arch");
|
|
|
|
CmdArgs.push_back(getToolChain().getArchName().c_str());
|
|
|
|
|
2009-03-18 11:07:30 +03:00
|
|
|
if (Output.isPipe()) {
|
|
|
|
CmdArgs.push_back("-o");
|
|
|
|
CmdArgs.push_back("-");
|
2009-03-19 10:29:38 +03:00
|
|
|
} else if (Output.isFilename()) {
|
2009-03-18 11:07:30 +03:00
|
|
|
CmdArgs.push_back("-o");
|
2009-03-19 10:29:38 +03:00
|
|
|
CmdArgs.push_back(Output.getFilename());
|
|
|
|
} else {
|
|
|
|
assert(Output.isNothing() && "Invalid output.");
|
2009-03-18 11:07:30 +03:00
|
|
|
}
|
|
|
|
|
2009-03-18 13:01:51 +03:00
|
|
|
for (InputInfoList::const_iterator
|
|
|
|
it = Inputs.begin(), ie = Inputs.end(); it != ie; ++it) {
|
|
|
|
const InputInfo &II = *it;
|
|
|
|
CmdArgs.push_back("-x");
|
|
|
|
CmdArgs.push_back(types::getTypeName(II.getType()));
|
|
|
|
if (II.isPipe())
|
|
|
|
CmdArgs.push_back("-");
|
2009-03-19 10:29:38 +03:00
|
|
|
else if (II.isFilename())
|
|
|
|
CmdArgs.push_back(II.getFilename());
|
2009-03-18 13:01:51 +03:00
|
|
|
else
|
2009-03-19 10:29:38 +03:00
|
|
|
II.getInputArg().renderAsInput(Args, CmdArgs);
|
2009-03-18 13:01:51 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
const char *Exec =
|
|
|
|
Args.MakeArgString(getToolChain().GetProgramPath(C, "clang").c_str());
|
|
|
|
Dest.addCommand(new Command(Exec, CmdArgs));
|
2009-03-18 09:00:36 +03:00
|
|
|
}
|
|
|
|
|
2009-03-18 11:07:30 +03:00
|
|
|
void gcc::Common::ConstructJob(Compilation &C, const JobAction &JA,
|
|
|
|
Job &Dest,
|
|
|
|
const InputInfo &Output,
|
|
|
|
const InputInfoList &Inputs,
|
2009-03-18 13:01:51 +03:00
|
|
|
const ArgList &Args,
|
2009-03-18 11:07:30 +03:00
|
|
|
const char *LinkingOutput) const {
|
|
|
|
ArgStringList CmdArgs;
|
|
|
|
|
|
|
|
for (ArgList::const_iterator
|
2009-03-18 13:01:51 +03:00
|
|
|
it = Args.begin(), ie = Args.end(); it != ie; ++it) {
|
2009-03-18 11:07:30 +03:00
|
|
|
Arg *A = *it;
|
|
|
|
if (A->getOption().hasForwardToGCC())
|
2009-03-18 13:01:51 +03:00
|
|
|
A->render(Args, CmdArgs);
|
2009-03-18 11:07:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
RenderExtraToolArgs(CmdArgs);
|
|
|
|
|
|
|
|
// If using a driver driver, force the arch.
|
|
|
|
if (getToolChain().getHost().useDriverDriver()) {
|
|
|
|
CmdArgs.push_back("-arch");
|
|
|
|
CmdArgs.push_back(getToolChain().getArchName().c_str());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Output.isPipe()) {
|
|
|
|
CmdArgs.push_back("-o");
|
|
|
|
CmdArgs.push_back("-");
|
2009-03-19 10:29:38 +03:00
|
|
|
} else if (Output.isFilename()) {
|
2009-03-18 11:07:30 +03:00
|
|
|
CmdArgs.push_back("-o");
|
2009-03-19 10:29:38 +03:00
|
|
|
CmdArgs.push_back(Output.getFilename());
|
|
|
|
} else {
|
|
|
|
assert(Output.isNothing() && "Unexpected output");
|
2009-03-18 11:07:30 +03:00
|
|
|
CmdArgs.push_back("-fsyntax-only");
|
2009-03-19 10:29:38 +03:00
|
|
|
}
|
2009-03-18 11:07:30 +03:00
|
|
|
|
|
|
|
|
|
|
|
// Only pass -x if gcc will understand it; otherwise hope gcc
|
|
|
|
// understands the suffix correctly. The main use case this would go
|
|
|
|
// wrong in is for linker inputs if they happened to have an odd
|
|
|
|
// suffix; really the only way to get this to happen is a command
|
|
|
|
// like '-x foobar a.c' which will treat a.c like a linker input.
|
|
|
|
//
|
|
|
|
// FIXME: For the linker case specifically, can we safely convert
|
|
|
|
// inputs into '-Wl,' options?
|
|
|
|
for (InputInfoList::const_iterator
|
|
|
|
it = Inputs.begin(), ie = Inputs.end(); it != ie; ++it) {
|
|
|
|
const InputInfo &II = *it;
|
|
|
|
if (types::canTypeBeUserSpecified(II.getType())) {
|
|
|
|
CmdArgs.push_back("-x");
|
|
|
|
CmdArgs.push_back(types::getTypeName(II.getType()));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (II.isPipe())
|
|
|
|
CmdArgs.push_back("-");
|
2009-03-19 10:29:38 +03:00
|
|
|
else if (II.isFilename())
|
|
|
|
CmdArgs.push_back(II.getFilename());
|
2009-03-18 11:07:30 +03:00
|
|
|
else
|
2009-03-19 10:29:38 +03:00
|
|
|
// Don't render as input, we need gcc to do the translations.
|
|
|
|
II.getInputArg().render(Args, CmdArgs);
|
2009-03-18 11:07:30 +03:00
|
|
|
}
|
|
|
|
|
2009-03-19 00:34:08 +03:00
|
|
|
const char *Exec =
|
|
|
|
Args.MakeArgString(getToolChain().GetProgramPath(C, "gcc").c_str());
|
|
|
|
Dest.addCommand(new Command(Exec, CmdArgs));
|
2009-03-18 09:00:36 +03:00
|
|
|
}
|
|
|
|
|
2009-03-18 11:07:30 +03:00
|
|
|
void gcc::Preprocess::RenderExtraToolArgs(ArgStringList &CmdArgs) const {
|
|
|
|
CmdArgs.push_back("-E");
|
2009-03-18 09:00:36 +03:00
|
|
|
}
|
|
|
|
|
2009-03-18 11:07:30 +03:00
|
|
|
void gcc::Precompile::RenderExtraToolArgs(ArgStringList &CmdArgs) const {
|
|
|
|
// The type is good enough.
|
2009-03-18 09:00:36 +03:00
|
|
|
}
|
|
|
|
|
2009-03-18 11:07:30 +03:00
|
|
|
void gcc::Compile::RenderExtraToolArgs(ArgStringList &CmdArgs) const {
|
|
|
|
CmdArgs.push_back("-S");
|
2009-03-18 09:00:36 +03:00
|
|
|
}
|
|
|
|
|
2009-03-18 11:07:30 +03:00
|
|
|
void gcc::Assemble::RenderExtraToolArgs(ArgStringList &CmdArgs) const {
|
|
|
|
CmdArgs.push_back("-c");
|
|
|
|
}
|
2009-03-18 09:00:36 +03:00
|
|
|
|
2009-03-18 11:07:30 +03:00
|
|
|
void gcc::Link::RenderExtraToolArgs(ArgStringList &CmdArgs) const {
|
|
|
|
// The types are (hopefully) good enough.
|
2009-03-18 09:00:36 +03:00
|
|
|
}
|
2009-03-18 11:07:30 +03:00
|
|
|
|