forked from OSchip/llvm-project
[Driver] Add output file to properties of Command
Object of class `Command` contains various properties of a command to execute, but output file was missed from them. This change adds this property. It is required for reporting consumed time and memory implemented in D78903 and may be used in other cases too. Differential Revision: https://reviews.llvm.org/D78902
This commit is contained in:
parent
06758c6a61
commit
70bf35070a
|
@ -122,6 +122,9 @@ class Command {
|
|||
/// The list of program arguments which are inputs.
|
||||
llvm::opt::ArgStringList InputFilenames;
|
||||
|
||||
/// The list of program arguments which are outputs. May be empty.
|
||||
std::vector<std::string> OutputFilenames;
|
||||
|
||||
/// Response file name, if this command is set to use one, or nullptr
|
||||
/// otherwise
|
||||
const char *ResponseFile = nullptr;
|
||||
|
@ -158,8 +161,8 @@ public:
|
|||
|
||||
Command(const Action &Source, const Tool &Creator,
|
||||
ResponseFileSupport ResponseSupport, const char *Executable,
|
||||
const llvm::opt::ArgStringList &Arguments,
|
||||
ArrayRef<InputInfo> Inputs);
|
||||
const llvm::opt::ArgStringList &Arguments, ArrayRef<InputInfo> Inputs,
|
||||
ArrayRef<InputInfo> Outputs = None);
|
||||
// FIXME: This really shouldn't be copyable, but is currently copied in some
|
||||
// error handling in Driver::generateCompilationDiagnostics.
|
||||
Command(const Command &) = default;
|
||||
|
@ -201,6 +204,14 @@ public:
|
|||
|
||||
const llvm::opt::ArgStringList &getArguments() const { return Arguments; }
|
||||
|
||||
const llvm::opt::ArgStringList &getInputFilenames() const {
|
||||
return InputFilenames;
|
||||
}
|
||||
|
||||
const std::vector<std::string> &getOutputFilenames() const {
|
||||
return OutputFilenames;
|
||||
}
|
||||
|
||||
protected:
|
||||
/// Optionally print the filenames to be compiled
|
||||
void PrintFileNames() const;
|
||||
|
@ -212,7 +223,7 @@ public:
|
|||
CC1Command(const Action &Source, const Tool &Creator,
|
||||
ResponseFileSupport ResponseSupport, const char *Executable,
|
||||
const llvm::opt::ArgStringList &Arguments,
|
||||
ArrayRef<InputInfo> Inputs);
|
||||
ArrayRef<InputInfo> Inputs, ArrayRef<InputInfo> Outputs = None);
|
||||
|
||||
void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote,
|
||||
CrashReportInfo *CrashInfo = nullptr) const override;
|
||||
|
@ -230,7 +241,7 @@ public:
|
|||
FallbackCommand(const Action &Source_, const Tool &Creator_,
|
||||
ResponseFileSupport ResponseSupport, const char *Executable_,
|
||||
const llvm::opt::ArgStringList &Arguments_,
|
||||
ArrayRef<InputInfo> Inputs,
|
||||
ArrayRef<InputInfo> Inputs, ArrayRef<InputInfo> Outputs,
|
||||
std::unique_ptr<Command> Fallback_);
|
||||
|
||||
void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote,
|
||||
|
@ -250,7 +261,8 @@ public:
|
|||
ResponseFileSupport ResponseSupport,
|
||||
const char *Executable_,
|
||||
const llvm::opt::ArgStringList &Arguments_,
|
||||
ArrayRef<InputInfo> Inputs);
|
||||
ArrayRef<InputInfo> Inputs,
|
||||
ArrayRef<InputInfo> Outputs = None);
|
||||
|
||||
void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote,
|
||||
CrashReportInfo *CrashInfo = nullptr) const override;
|
||||
|
|
|
@ -38,12 +38,15 @@ using namespace driver;
|
|||
Command::Command(const Action &Source, const Tool &Creator,
|
||||
ResponseFileSupport ResponseSupport, const char *Executable,
|
||||
const llvm::opt::ArgStringList &Arguments,
|
||||
ArrayRef<InputInfo> Inputs)
|
||||
ArrayRef<InputInfo> Inputs, ArrayRef<InputInfo> Outputs)
|
||||
: Source(Source), Creator(Creator), ResponseSupport(ResponseSupport),
|
||||
Executable(Executable), Arguments(Arguments) {
|
||||
for (const auto &II : Inputs)
|
||||
if (II.isFilename())
|
||||
InputFilenames.push_back(II.getFilename());
|
||||
for (const auto &II : Outputs)
|
||||
if (II.isFilename())
|
||||
OutputFilenames.push_back(II.getFilename());
|
||||
}
|
||||
|
||||
/// Check if the compiler flag in question should be skipped when
|
||||
|
@ -357,8 +360,9 @@ CC1Command::CC1Command(const Action &Source, const Tool &Creator,
|
|||
ResponseFileSupport ResponseSupport,
|
||||
const char *Executable,
|
||||
const llvm::opt::ArgStringList &Arguments,
|
||||
ArrayRef<InputInfo> Inputs)
|
||||
: Command(Source, Creator, ResponseSupport, Executable, Arguments, Inputs) {
|
||||
ArrayRef<InputInfo> Inputs, ArrayRef<InputInfo> Outputs)
|
||||
: Command(Source, Creator, ResponseSupport, Executable, Arguments, Inputs,
|
||||
Outputs) {
|
||||
InProcess = true;
|
||||
}
|
||||
|
||||
|
@ -415,9 +419,10 @@ FallbackCommand::FallbackCommand(const Action &Source_, const Tool &Creator_,
|
|||
const char *Executable_,
|
||||
const llvm::opt::ArgStringList &Arguments_,
|
||||
ArrayRef<InputInfo> Inputs,
|
||||
ArrayRef<InputInfo> Outputs,
|
||||
std::unique_ptr<Command> Fallback_)
|
||||
: Command(Source_, Creator_, ResponseSupport, Executable_, Arguments_,
|
||||
Inputs),
|
||||
Inputs, Outputs),
|
||||
Fallback(std::move(Fallback_)) {}
|
||||
|
||||
void FallbackCommand::Print(raw_ostream &OS, const char *Terminator,
|
||||
|
@ -456,9 +461,10 @@ int FallbackCommand::Execute(ArrayRef<llvm::Optional<StringRef>> Redirects,
|
|||
ForceSuccessCommand::ForceSuccessCommand(
|
||||
const Action &Source_, const Tool &Creator_,
|
||||
ResponseFileSupport ResponseSupport, const char *Executable_,
|
||||
const llvm::opt::ArgStringList &Arguments_, ArrayRef<InputInfo> Inputs)
|
||||
const llvm::opt::ArgStringList &Arguments_, ArrayRef<InputInfo> Inputs,
|
||||
ArrayRef<InputInfo> Outputs)
|
||||
: Command(Source_, Creator_, ResponseSupport, Executable_, Arguments_,
|
||||
Inputs) {}
|
||||
Inputs, Outputs) {}
|
||||
|
||||
void ForceSuccessCommand::Print(raw_ostream &OS, const char *Terminator,
|
||||
bool Quote, CrashReportInfo *CrashInfo) const {
|
||||
|
|
|
@ -71,7 +71,7 @@ void aix::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
|
||||
const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
|
||||
Exec, CmdArgs, Inputs));
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
void aix::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
|
@ -170,7 +170,7 @@ void aix::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
|
||||
const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
|
||||
C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
|
||||
Exec, CmdArgs, Inputs));
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
/// AIX - AIX tool chain which can call as(1) and ld(1) directly.
|
||||
|
|
|
@ -356,9 +356,9 @@ void amdgpu::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
CmdArgs.push_back("-shared");
|
||||
CmdArgs.push_back("-o");
|
||||
CmdArgs.push_back(Output.getFilename());
|
||||
C.addCommand(
|
||||
std::make_unique<Command>(JA, *this, ResponseFileSupport::AtFileCurCP(),
|
||||
Args.MakeArgString(Linker), CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileCurCP(), Args.MakeArgString(Linker),
|
||||
CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
void amdgpu::getAMDGPUTargetFeatures(const Driver &D,
|
||||
|
|
|
@ -142,9 +142,9 @@ void AVR::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
CmdArgs.push_back(Args.MakeArgString(std::string("-m") + *FamilyName));
|
||||
}
|
||||
|
||||
C.addCommand(
|
||||
std::make_unique<Command>(JA, *this, ResponseFileSupport::AtFileCurCP(),
|
||||
Args.MakeArgString(Linker), CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileCurCP(), Args.MakeArgString(Linker),
|
||||
CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
llvm::Optional<std::string> AVRToolChain::findAVRLibcInstallation() const {
|
||||
|
|
|
@ -39,8 +39,9 @@ void ananas::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
CmdArgs.push_back(II.getFilename());
|
||||
|
||||
const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileCurCP(), Exec, CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this,
|
||||
ResponseFileSupport::AtFileCurCP(),
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
void ananas::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
|
@ -124,8 +125,9 @@ void ananas::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
}
|
||||
|
||||
const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileCurCP(), Exec, CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this,
|
||||
ResponseFileSupport::AtFileCurCP(),
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
// Ananas - Ananas tool chain which can call as(1) and ld(1) directly.
|
||||
|
|
|
@ -202,5 +202,5 @@ void baremetal::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
|
||||
C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
|
||||
Args.MakeArgString(TC.GetLinkerPath()),
|
||||
CmdArgs, Inputs));
|
||||
CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
|
|
@ -4356,9 +4356,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
II.getInputArg().renderAsInput(Args, CmdArgs);
|
||||
}
|
||||
|
||||
C.addCommand(
|
||||
std::make_unique<Command>(JA, *this, ResponseFileSupport::AtFileUTF8(),
|
||||
D.getClangProgramPath(), CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileUTF8(), D.getClangProgramPath(),
|
||||
CmdArgs, Inputs, Output));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -6314,20 +6314,23 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
getCLFallback()->GetCommand(C, JA, Output, Inputs, Args, LinkingOutput);
|
||||
C.addCommand(std::make_unique<FallbackCommand>(
|
||||
JA, *this, ResponseFileSupport::AtFileUTF8(), Exec, CmdArgs, Inputs,
|
||||
std::move(CLCommand)));
|
||||
Output, std::move(CLCommand)));
|
||||
} else if (Args.hasArg(options::OPT__SLASH_fallback) &&
|
||||
isa<PrecompileJobAction>(JA)) {
|
||||
// In /fallback builds, run the main compilation even if the pch generation
|
||||
// fails, so that the main compilation's fallback to cl.exe runs.
|
||||
C.addCommand(std::make_unique<ForceSuccessCommand>(
|
||||
JA, *this, ResponseFileSupport::AtFileUTF8(), Exec, CmdArgs, Inputs));
|
||||
JA, *this, ResponseFileSupport::AtFileUTF8(), Exec, CmdArgs, Inputs,
|
||||
Output));
|
||||
} else if (D.CC1Main && !D.CCGenDiagnostics) {
|
||||
// Invoke the CC1 directly in this process
|
||||
C.addCommand(std::make_unique<CC1Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileUTF8(), Exec, CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<CC1Command>(JA, *this,
|
||||
ResponseFileSupport::AtFileUTF8(),
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
} else {
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileUTF8(), Exec, CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this,
|
||||
ResponseFileSupport::AtFileUTF8(),
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
// Make the compile command echo its inputs for /showFilenames.
|
||||
|
@ -7074,8 +7077,9 @@ void ClangAs::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
CmdArgs.push_back(Input.getFilename());
|
||||
|
||||
const char *Exec = getToolChain().getDriver().getClangProgramPath();
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileUTF8(), Exec, CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this,
|
||||
ResponseFileSupport::AtFileUTF8(),
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
// Begin OffloadBundler
|
||||
|
@ -7161,7 +7165,7 @@ void OffloadBundler::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::None(),
|
||||
TCArgs.MakeArgString(getToolChain().GetProgramPath(getShortName())),
|
||||
CmdArgs, None));
|
||||
CmdArgs, None, Output));
|
||||
}
|
||||
|
||||
void OffloadBundler::ConstructJobMultipleOutputs(
|
||||
|
@ -7227,7 +7231,7 @@ void OffloadBundler::ConstructJobMultipleOutputs(
|
|||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::None(),
|
||||
TCArgs.MakeArgString(getToolChain().GetProgramPath(getShortName())),
|
||||
CmdArgs, None));
|
||||
CmdArgs, None, Outputs));
|
||||
}
|
||||
|
||||
void OffloadWrapper::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
|
@ -7257,5 +7261,5 @@ void OffloadWrapper::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::None(),
|
||||
Args.MakeArgString(getToolChain().GetProgramPath(getShortName())),
|
||||
CmdArgs, Inputs));
|
||||
CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
|
|
@ -92,8 +92,9 @@ void cloudabi::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtend.o")));
|
||||
|
||||
const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileCurCP(), Exec, CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this,
|
||||
ResponseFileSupport::AtFileCurCP(),
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
// CloudABI - CloudABI tool chain which can call ld(1) directly.
|
||||
|
|
|
@ -951,12 +951,13 @@ void tools::SplitDebugInfo(const ToolChain &TC, Compilation &C, const Tool &T,
|
|||
InputInfo II(types::TY_Object, Output.getFilename(), Output.getFilename());
|
||||
|
||||
// First extract the dwo sections.
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, T, ResponseFileSupport::AtFileCurCP(), Exec, ExtractArgs, II));
|
||||
C.addCommand(std::make_unique<Command>(JA, T,
|
||||
ResponseFileSupport::AtFileCurCP(),
|
||||
Exec, ExtractArgs, II, Output));
|
||||
|
||||
// Then remove them from the original .o file.
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, T, ResponseFileSupport::AtFileCurCP(), Exec, StripArgs, II));
|
||||
JA, T, ResponseFileSupport::AtFileCurCP(), Exec, StripArgs, II, Output));
|
||||
}
|
||||
|
||||
// Claim options we don't want to warn if they are unused. We do this for
|
||||
|
|
|
@ -58,7 +58,7 @@ void tools::CrossWindows::Assembler::ConstructJob(
|
|||
Exec = Args.MakeArgString(Assembler);
|
||||
|
||||
C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
|
||||
Exec, CmdArgs, Inputs));
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
void tools::CrossWindows::Linker::ConstructJob(
|
||||
|
@ -203,8 +203,9 @@ void tools::CrossWindows::Linker::ConstructJob(
|
|||
|
||||
Exec = Args.MakeArgString(TC.GetLinkerPath());
|
||||
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileUTF8(), Exec, CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this,
|
||||
ResponseFileSupport::AtFileUTF8(),
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
CrossWindowsToolChain::CrossWindowsToolChain(const Driver &D,
|
||||
|
|
|
@ -427,7 +427,7 @@ void NVPTX::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
JA, *this,
|
||||
ResponseFileSupport{ResponseFileSupport::RF_Full, llvm::sys::WEM_UTF8,
|
||||
"--options-file"},
|
||||
Exec, CmdArgs, Inputs));
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
static bool shouldIncludePTX(const ArgList &Args, const char *gpu_arch) {
|
||||
|
@ -496,7 +496,7 @@ void NVPTX::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
JA, *this,
|
||||
ResponseFileSupport{ResponseFileSupport::RF_Full, llvm::sys::WEM_UTF8,
|
||||
"--options-file"},
|
||||
Exec, CmdArgs, Inputs));
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
void NVPTX::OpenMPLinker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
|
@ -577,7 +577,7 @@ void NVPTX::OpenMPLinker::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
JA, *this,
|
||||
ResponseFileSupport{ResponseFileSupport::RF_Full, llvm::sys::WEM_UTF8,
|
||||
"--options-file"},
|
||||
Exec, CmdArgs, Inputs));
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
/// CUDA toolchain. Our assembler is ptxas, and our "linker" is fatbinary,
|
||||
|
|
|
@ -149,7 +149,7 @@ void darwin::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
|
||||
const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
|
||||
Exec, CmdArgs, Inputs));
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
void darwin::MachOTool::anchor() {}
|
||||
|
@ -522,7 +522,7 @@ void darwin::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
Args.MakeArgString(getToolChain().GetProgramPath("touch"));
|
||||
CmdArgs.push_back(Output.getFilename());
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::None(), Exec, CmdArgs, None));
|
||||
JA, *this, ResponseFileSupport::None(), Exec, CmdArgs, None, Output));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -695,7 +695,7 @@ void darwin::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
|
||||
const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath());
|
||||
std::unique_ptr<Command> Cmd = std::make_unique<Command>(
|
||||
JA, *this, ResponseSupport, Exec, CmdArgs, Inputs);
|
||||
JA, *this, ResponseSupport, Exec, CmdArgs, Inputs, Output);
|
||||
Cmd->setInputFileList(std::move(InputFileList));
|
||||
C.addCommand(std::move(Cmd));
|
||||
}
|
||||
|
@ -720,7 +720,7 @@ void darwin::Lipo::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
|
||||
const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("lipo"));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
|
||||
Exec, CmdArgs, Inputs));
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
void darwin::Dsymutil::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
|
@ -741,7 +741,7 @@ void darwin::Dsymutil::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
const char *Exec =
|
||||
Args.MakeArgString(getToolChain().GetProgramPath("dsymutil"));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
|
||||
Exec, CmdArgs, Inputs));
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
void darwin::VerifyDebug::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
|
@ -765,7 +765,7 @@ void darwin::VerifyDebug::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
const char *Exec =
|
||||
Args.MakeArgString(getToolChain().GetProgramPath("dwarfdump"));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
|
||||
Exec, CmdArgs, Inputs));
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
MachO::MachO(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
|
||||
|
|
|
@ -45,8 +45,9 @@ void dragonfly::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
CmdArgs.push_back(II.getFilename());
|
||||
|
||||
const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileCurCP(), Exec, CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this,
|
||||
ResponseFileSupport::AtFileCurCP(),
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
void dragonfly::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
|
@ -170,8 +171,9 @@ void dragonfly::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
getToolChain().addProfileRTLibs(Args, CmdArgs);
|
||||
|
||||
const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath());
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileCurCP(), Exec, CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this,
|
||||
ResponseFileSupport::AtFileCurCP(),
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
/// DragonFly - DragonFly tool chain which can call as(1) and ld(1) directly.
|
||||
|
|
|
@ -72,8 +72,9 @@ void Flang::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
// TODO: Replace flang-new with flang once the new driver replaces the
|
||||
// throwaway driver
|
||||
const char *Exec = Args.MakeArgString(D.GetProgramPath("flang-new", TC));
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileUTF8(), Exec, CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this,
|
||||
ResponseFileSupport::AtFileUTF8(),
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
Flang::Flang(const ToolChain &TC) : Tool("flang-new", "flang frontend", TC) {}
|
||||
|
|
|
@ -128,8 +128,9 @@ void freebsd::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
CmdArgs.push_back(II.getFilename());
|
||||
|
||||
const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileCurCP(), Exec, CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this,
|
||||
ResponseFileSupport::AtFileCurCP(),
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
|
@ -359,8 +360,9 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
ToolChain.addProfileRTLibs(Args, CmdArgs);
|
||||
|
||||
const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath());
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileCurCP(), Exec, CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this,
|
||||
ResponseFileSupport::AtFileCurCP(),
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
/// FreeBSD - FreeBSD tool chain which can call as(1) and ld(1) directly.
|
||||
|
|
|
@ -167,7 +167,7 @@ void fuchsia::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
}
|
||||
|
||||
C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
|
||||
Exec, CmdArgs, Inputs));
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
/// Fuchsia - Fuchsia tool chain which can call as(1) and ld(1) directly.
|
||||
|
|
|
@ -171,8 +171,9 @@ void tools::gcc::Common::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
GCCName = "gcc";
|
||||
|
||||
const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath(GCCName));
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileCurCP(), Exec, CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this,
|
||||
ResponseFileSupport::AtFileCurCP(),
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
void tools::gcc::Preprocessor::RenderExtraToolArgs(
|
||||
|
@ -364,8 +365,9 @@ void tools::gnutools::StaticLibTool::ConstructJob(
|
|||
}
|
||||
|
||||
const char *Exec = Args.MakeArgString(getToolChain().GetStaticLibToolPath());
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileCurCP(), Exec, CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this,
|
||||
ResponseFileSupport::AtFileCurCP(),
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
|
@ -662,8 +664,9 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
Args.AddAllArgs(CmdArgs, options::OPT_T);
|
||||
|
||||
const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileCurCP(), Exec, CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this,
|
||||
ResponseFileSupport::AtFileCurCP(),
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
void tools::gnutools::Assembler::ConstructJob(Compilation &C,
|
||||
|
@ -930,8 +933,9 @@ void tools::gnutools::Assembler::ConstructJob(Compilation &C,
|
|||
|
||||
const char *Exec =
|
||||
Args.MakeArgString(getToolChain().GetProgramPath(DefaultAssembler));
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileCurCP(), Exec, CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this,
|
||||
ResponseFileSupport::AtFileCurCP(),
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
|
||||
// Handle the debug info splitting at object creation time if we're
|
||||
// creating an object.
|
||||
|
|
|
@ -98,7 +98,7 @@ void AMDGCN::Linker::constructLldCommand(Compilation &C, const JobAction &JA,
|
|||
LldArgs.push_back(Input.getFilename());
|
||||
const char *Lld = Args.MakeArgString(getToolChain().GetProgramPath("lld"));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
|
||||
Lld, LldArgs, Inputs));
|
||||
Lld, LldArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
// Construct a clang-offload-bundler command to bundle code objects for
|
||||
|
@ -127,14 +127,16 @@ void AMDGCN::constructHIPFatbinCommand(Compilation &C, const JobAction &JA,
|
|||
BundlerArgs.push_back(Args.MakeArgString(BundlerTargetArg));
|
||||
BundlerArgs.push_back(Args.MakeArgString(BundlerInputArg));
|
||||
|
||||
auto BundlerOutputArg = Args.MakeArgString(
|
||||
std::string("-outputs=").append(std::string(OutputFileName)));
|
||||
std::string Output = std::string(OutputFileName);
|
||||
auto BundlerOutputArg =
|
||||
Args.MakeArgString(std::string("-outputs=").append(Output));
|
||||
BundlerArgs.push_back(BundlerOutputArg);
|
||||
|
||||
const char *Bundler = Args.MakeArgString(
|
||||
T.getToolChain().GetProgramPath("clang-offload-bundler"));
|
||||
C.addCommand(std::make_unique<Command>(JA, T, ResponseFileSupport::None(),
|
||||
Bundler, BundlerArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, T, ResponseFileSupport::None(), Bundler, BundlerArgs, Inputs,
|
||||
InputInfo(&JA, Args.MakeArgString(Output))));
|
||||
}
|
||||
|
||||
/// Add Generated HIP Object File which has device images embedded into the
|
||||
|
@ -205,7 +207,7 @@ void AMDGCN::Linker::constructGenerateObjFileFromHIPFatBinary(
|
|||
McinFile, "--filetype=obj"};
|
||||
const char *Mc = Args.MakeArgString(TC.GetProgramPath("llvm-mc"));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
|
||||
Mc, McArgs, Inputs));
|
||||
Mc, McArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
// For amdgcn the inputs of the linker job are device bitcode and output is
|
||||
|
|
|
@ -189,8 +189,9 @@ void hexagon::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
}
|
||||
|
||||
auto *Exec = Args.MakeArgString(HTC.GetProgramPath(AsName));
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileCurCP(), Exec, CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this,
|
||||
ResponseFileSupport::AtFileCurCP(),
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
void hexagon::Linker::RenderExtraToolArgs(const JobAction &JA,
|
||||
|
@ -407,8 +408,9 @@ void hexagon::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
LinkingOutput);
|
||||
|
||||
const char *Exec = Args.MakeArgString(HTC.GetLinkerPath());
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileCurCP(), Exec, CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this,
|
||||
ResponseFileSupport::AtFileCurCP(),
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
// Hexagon tools end.
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ void Merger::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
|
||||
C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
|
||||
Args.MakeArgString(Merger), CmdArgs,
|
||||
Inputs));
|
||||
Inputs, Output));
|
||||
}
|
||||
} // namespace ifstool
|
||||
} // namespace tools
|
||||
|
|
|
@ -312,7 +312,7 @@ void msp430::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
|
||||
Args.AddAllArgs(CmdArgs, options::OPT_T);
|
||||
|
||||
C.addCommand(
|
||||
std::make_unique<Command>(JA, *this, ResponseFileSupport::AtFileCurCP(),
|
||||
Args.MakeArgString(Linker), CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileCurCP(), Args.MakeArgString(Linker),
|
||||
CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
|
|
@ -606,9 +606,9 @@ void visualstudio::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
linkPath = TC.GetProgramPath(Linker.str().c_str());
|
||||
}
|
||||
|
||||
auto LinkCmd =
|
||||
std::make_unique<Command>(JA, *this, ResponseFileSupport::AtFileUTF16(),
|
||||
Args.MakeArgString(linkPath), CmdArgs, Inputs);
|
||||
auto LinkCmd = std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileUTF16(),
|
||||
Args.MakeArgString(linkPath), CmdArgs, Inputs, Output);
|
||||
if (!Environment.empty())
|
||||
LinkCmd->setEnvironment(Environment);
|
||||
C.addCommand(std::move(LinkCmd));
|
||||
|
@ -748,9 +748,9 @@ std::unique_ptr<Command> visualstudio::Compiler::GetCommand(
|
|||
CmdArgs.push_back(Fo);
|
||||
|
||||
std::string Exec = FindVisualStudioExecutable(getToolChain(), "cl.exe");
|
||||
return std::make_unique<Command>(JA, *this,
|
||||
ResponseFileSupport::AtFileUTF16(),
|
||||
Args.MakeArgString(Exec), CmdArgs, Inputs);
|
||||
return std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileUTF16(), Args.MakeArgString(Exec),
|
||||
CmdArgs, Inputs, Output);
|
||||
}
|
||||
|
||||
MSVCToolChain::MSVCToolChain(const Driver &D, const llvm::Triple &Triple,
|
||||
|
|
|
@ -51,7 +51,7 @@ void tools::MinGW::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
|
||||
const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
|
||||
Exec, CmdArgs, Inputs));
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
|
||||
if (Args.hasArg(options::OPT_gsplit_dwarf))
|
||||
SplitDebugInfo(getToolChain(), C, *this, JA, Args, Output,
|
||||
|
@ -167,9 +167,10 @@ void tools::MinGW::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
// that lacks an extension.
|
||||
// GCC used to do this only when the compiler itself runs on windows, but
|
||||
// since GCC 8 it does the same when cross compiling as well.
|
||||
if (!llvm::sys::path::has_extension(OutputFile))
|
||||
if (!llvm::sys::path::has_extension(OutputFile)) {
|
||||
CmdArgs.push_back(Args.MakeArgString(Twine(OutputFile) + ".exe"));
|
||||
else
|
||||
OutputFile = CmdArgs.back();
|
||||
} else
|
||||
CmdArgs.push_back(OutputFile);
|
||||
|
||||
Args.AddAllArgs(CmdArgs, options::OPT_e);
|
||||
|
@ -318,8 +319,9 @@ void tools::MinGW::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
}
|
||||
}
|
||||
const char *Exec = Args.MakeArgString(TC.GetLinkerPath());
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileUTF8(), Exec, CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this,
|
||||
ResponseFileSupport::AtFileUTF8(),
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
// Simplified from Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple.
|
||||
|
|
|
@ -36,8 +36,9 @@ void tools::minix::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
CmdArgs.push_back(II.getFilename());
|
||||
|
||||
const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileCurCP(), Exec, CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this,
|
||||
ResponseFileSupport::AtFileCurCP(),
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
void tools::minix::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
|
@ -89,8 +90,9 @@ void tools::minix::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
}
|
||||
|
||||
const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath());
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileCurCP(), Exec, CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this,
|
||||
ResponseFileSupport::AtFileCurCP(),
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
/// Minix - Minix tool chain which can call as(1) and ld(1) directly.
|
||||
|
|
|
@ -79,7 +79,7 @@ void tools::SHAVE::Compiler::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
Args.MakeArgString(getToolChain().GetProgramPath("moviCompile"));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
|
||||
Args.MakeArgString(Exec), CmdArgs,
|
||||
Inputs));
|
||||
Inputs, Output));
|
||||
}
|
||||
|
||||
void tools::SHAVE::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
|
@ -115,7 +115,7 @@ void tools::SHAVE::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
Args.MakeArgString(getToolChain().GetProgramPath("moviAsm"));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
|
||||
Args.MakeArgString(Exec), CmdArgs,
|
||||
Inputs));
|
||||
Inputs, Output));
|
||||
}
|
||||
|
||||
void tools::Myriad::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
|
@ -200,9 +200,9 @@ void tools::Myriad::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
|
||||
std::string Exec =
|
||||
Args.MakeArgString(TC.GetProgramPath("sparc-myriad-rtems-ld"));
|
||||
C.addCommand(
|
||||
std::make_unique<Command>(JA, *this, ResponseFileSupport::AtFileCurCP(),
|
||||
Args.MakeArgString(Exec), CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileCurCP(), Args.MakeArgString(Exec),
|
||||
CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
MyriadToolChain::MyriadToolChain(const Driver &D, const llvm::Triple &Triple,
|
||||
|
|
|
@ -193,8 +193,9 @@ void nacltools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
}
|
||||
|
||||
const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileCurCP(), Exec, CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this,
|
||||
ResponseFileSupport::AtFileCurCP(),
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
/// NaCl Toolchain
|
||||
|
|
|
@ -103,8 +103,9 @@ void netbsd::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
CmdArgs.push_back(II.getFilename());
|
||||
|
||||
const char *Exec = Args.MakeArgString((getToolChain().GetProgramPath("as")));
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileCurCP(), Exec, CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this,
|
||||
ResponseFileSupport::AtFileCurCP(),
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
void netbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
|
@ -338,8 +339,9 @@ void netbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
ToolChain.addProfileRTLibs(Args, CmdArgs);
|
||||
|
||||
const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileCurCP(), Exec, CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this,
|
||||
ResponseFileSupport::AtFileCurCP(),
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
/// NetBSD - NetBSD tool chain which can call as(1) and ld(1) directly.
|
||||
|
|
|
@ -82,8 +82,9 @@ void openbsd::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
CmdArgs.push_back(II.getFilename());
|
||||
|
||||
const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileCurCP(), Exec, CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this,
|
||||
ResponseFileSupport::AtFileCurCP(),
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
void openbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
|
@ -221,8 +222,9 @@ void openbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
}
|
||||
|
||||
const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileCurCP(), Exec, CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this,
|
||||
ResponseFileSupport::AtFileCurCP(),
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
SanitizerMask OpenBSD::getSupportedSanitizers() const {
|
||||
|
|
|
@ -66,8 +66,9 @@ void tools::PS4cpu::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
|
||||
const char *Exec =
|
||||
Args.MakeArgString(getToolChain().GetProgramPath("orbis-as"));
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileUTF8(), Exec, CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this,
|
||||
ResponseFileSupport::AtFileUTF8(),
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
static void AddPS4SanitizerArgs(const ToolChain &TC, ArgStringList &CmdArgs) {
|
||||
|
@ -152,8 +153,9 @@ void tools::PS4cpu::Link::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
const char *Exec =
|
||||
Args.MakeArgString(ToolChain.GetProgramPath("orbis-ld"));
|
||||
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileUTF8(), Exec, CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this,
|
||||
ResponseFileSupport::AtFileUTF8(),
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
toolchains::PS4CPU::PS4CPU(const Driver &D, const llvm::Triple &Triple,
|
||||
|
|
|
@ -191,8 +191,8 @@ void RISCV::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
|
||||
CmdArgs.push_back("-o");
|
||||
CmdArgs.push_back(Output.getFilename());
|
||||
C.addCommand(
|
||||
std::make_unique<Command>(JA, *this, ResponseFileSupport::AtFileCurCP(),
|
||||
Args.MakeArgString(Linker), CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileCurCP(), Args.MakeArgString(Linker),
|
||||
CmdArgs, Inputs, Output));
|
||||
}
|
||||
// RISCV tools end.
|
||||
|
|
|
@ -42,7 +42,7 @@ void solaris::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
|
||||
const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
|
||||
Exec, CmdArgs, Inputs));
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
void solaris::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
|
@ -152,7 +152,7 @@ void solaris::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
|
||||
const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath());
|
||||
C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
|
||||
Exec, CmdArgs, Inputs));
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
static StringRef getSolarisLibSuffix(const llvm::Triple &Triple) {
|
||||
|
|
|
@ -114,8 +114,9 @@ void wasm::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
CmdArgs.push_back("-o");
|
||||
CmdArgs.push_back(Output.getFilename());
|
||||
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileCurCP(), Linker, CmdArgs, Inputs));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this,
|
||||
ResponseFileSupport::AtFileCurCP(),
|
||||
Linker, CmdArgs, Inputs, Output));
|
||||
|
||||
// When optimizing, if wasm-opt is available, run it.
|
||||
if (Arg *A = Args.getLastArg(options::OPT_O_Group)) {
|
||||
|
@ -139,7 +140,7 @@ void wasm::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
CmdArgs.push_back(Output.getFilename());
|
||||
C.addCommand(std::make_unique<Command>(
|
||||
JA, *this, ResponseFileSupport::AtFileCurCP(), WasmOpt, CmdArgs,
|
||||
Inputs));
|
||||
Inputs, Output));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ void tools::XCore::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
|
||||
const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("xcc"));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
|
||||
Exec, CmdArgs, Inputs));
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
void tools::XCore::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
|
@ -82,7 +82,7 @@ void tools::XCore::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
|
||||
const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("xcc"));
|
||||
C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
|
||||
Exec, CmdArgs, Inputs));
|
||||
Exec, CmdArgs, Inputs, Output));
|
||||
}
|
||||
|
||||
/// XCore tool chain
|
||||
|
|
|
@ -259,4 +259,34 @@ TEST(ToolChainTest, GetTargetAndMode) {
|
|||
EXPECT_STREQ(Res.DriverMode, "--driver-mode=cl");
|
||||
EXPECT_FALSE(Res.TargetIsValid);
|
||||
}
|
||||
|
||||
TEST(ToolChainTest, CommandOutput) {
|
||||
IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions();
|
||||
|
||||
IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
|
||||
struct TestDiagnosticConsumer : public DiagnosticConsumer {};
|
||||
DiagnosticsEngine Diags(DiagID, &*DiagOpts, new TestDiagnosticConsumer);
|
||||
IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> InMemoryFileSystem(
|
||||
new llvm::vfs::InMemoryFileSystem);
|
||||
|
||||
Driver CCDriver("/home/test/bin/clang", "arm-linux-gnueabi", Diags,
|
||||
"clang LLVM compiler", InMemoryFileSystem);
|
||||
CCDriver.setCheckInputsExist(false);
|
||||
std::unique_ptr<Compilation> CC(
|
||||
CCDriver.BuildCompilation({"/home/test/bin/clang", "foo.cpp"}));
|
||||
const JobList &Jobs = CC->getJobs();
|
||||
|
||||
const auto &CmdCompile = Jobs.getJobs().front();
|
||||
const auto &InFile = CmdCompile->getInputFilenames().front();
|
||||
EXPECT_STREQ(InFile, "foo.cpp");
|
||||
auto ObjFile = CmdCompile->getOutputFilenames().front();
|
||||
EXPECT_TRUE(StringRef(ObjFile).endswith(".o"));
|
||||
|
||||
const auto &CmdLink = Jobs.getJobs().back();
|
||||
const auto LinkInFile = CmdLink->getInputFilenames().front();
|
||||
EXPECT_EQ(ObjFile, LinkInFile);
|
||||
auto ExeFile = CmdLink->getOutputFilenames().front();
|
||||
EXPECT_EQ("a.out", ExeFile);
|
||||
}
|
||||
|
||||
} // end anonymous namespace.
|
||||
|
|
Loading…
Reference in New Issue