Driver: Add Compilation::addCommand and switch tools to using it, now that we
don't have to deal with nested jobs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110015 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/Driver/Compilation.h b/include/clang/Driver/Compilation.h
index 5f062a1..22d6b4e 100644
--- a/include/clang/Driver/Compilation.h
+++ b/include/clang/Driver/Compilation.h
@@ -80,6 +80,8 @@
JobList &getJobs() { return Jobs; }
const JobList &getJobs() const { return Jobs; }
+ void addCommand(Command *C) { Jobs.addJob(C); }
+
const ArgStringList &getTempFiles() const { return TempFiles; }
const ArgStringList &getResultFiles() const { return ResultFiles; }
diff --git a/include/clang/Driver/Tool.h b/include/clang/Driver/Tool.h
index 8f166d4..c30fa4c 100644
--- a/include/clang/Driver/Tool.h
+++ b/include/clang/Driver/Tool.h
@@ -59,13 +59,11 @@
/// ConstructJob - Construct jobs to perform the action \arg JA,
/// writing to \arg Output and with \arg Inputs.
///
- /// \param Dest - Where to put the resulting commands.
/// \param TCArgs - The argument list for this toolchain, with any
/// tool chain specific translations applied.
/// \param LinkingOutput - If this output will eventually feed the
/// linker, then this is the final output name of the linked image.
virtual void ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest,
const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &TCArgs,
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
index 0fd22fe..98ac6cc 100644
--- a/lib/Driver/Driver.cpp
+++ b/lib/Driver/Driver.cpp
@@ -1102,7 +1102,7 @@
}
llvm::errs() << "], output: " << Result.getAsString() << "\n";
} else {
- T.ConstructJob(C, *JA, C.getJobs(), Result, InputInfos,
+ T.ConstructJob(C, *JA, Result, InputInfos,
C.getArgsForToolChain(TC, BoundArch), LinkingOutput);
}
}
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index e917692..d1dafe9 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -746,7 +746,6 @@
}
void Clang::ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest,
const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &Args,
@@ -1511,7 +1510,7 @@
CmdArgs.push_back(Args.MakeArgString(Flags.str()));
}
- Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
+ C.addCommand(new Command(JA, *this, Exec, CmdArgs));
// Explicitly warn that these options are unsupported, even though
// we are allowing compilation to continue.
@@ -1535,7 +1534,6 @@
}
void ClangAs::ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest,
const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &Args,
@@ -1587,11 +1585,10 @@
CmdArgs.push_back(Input.getFilename());
const char *Exec = getToolChain().getDriver().getClangProgramPath();
- Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
+ C.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
void gcc::Common::ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest,
const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &Args,
@@ -1683,7 +1680,7 @@
const char *GCCName = getToolChain().getDriver().CCCGenericGCCName.c_str();
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(GCCName));
- Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
+ C.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
void gcc::Preprocess::RenderExtraToolArgs(const JobAction &JA,
@@ -2053,7 +2050,7 @@
}
void darwin::Preprocess::ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest, const InputInfo &Output,
+ const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
@@ -2084,11 +2081,11 @@
const char *CC1Name = getCC1Name(Inputs[0].getType());
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(CC1Name));
- Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
+ C.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
void darwin::Compile::ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest, const InputInfo &Output,
+ const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
@@ -2179,11 +2176,11 @@
const char *CC1Name = getCC1Name(Inputs[0].getType());
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(CC1Name));
- Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
+ C.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
void darwin::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest, const InputInfo &Output,
+ const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
@@ -2232,7 +2229,7 @@
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath("as"));
- Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
+ C.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
void darwin::DarwinTool::AddDarwinArch(const ArgList &Args,
@@ -2393,7 +2390,7 @@
}
void darwin::Link::ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest, const InputInfo &Output,
+ const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
@@ -2551,11 +2548,11 @@
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath("ld"));
- Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
+ C.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
void darwin::Lipo::ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest, const InputInfo &Output,
+ const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
@@ -2575,11 +2572,11 @@
}
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath("lipo"));
- Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
+ C.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
void darwin::Dsymutil::ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest, const InputInfo &Output,
+ const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
@@ -2595,11 +2592,11 @@
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath("dsymutil"));
- Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
+ C.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
void auroraux::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest, const InputInfo &Output,
+ const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
@@ -2619,11 +2616,11 @@
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath("gas"));
- Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
+ C.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
void auroraux::Link::ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest, const InputInfo &Output,
+ const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
@@ -2720,11 +2717,11 @@
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath("ld"));
- Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
+ C.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
void openbsd::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest, const InputInfo &Output,
+ const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
@@ -2744,11 +2741,11 @@
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath("as"));
- Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
+ C.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
void openbsd::Link::ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest, const InputInfo &Output,
+ const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
@@ -2850,11 +2847,11 @@
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath("ld"));
- Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
+ C.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
void freebsd::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest, const InputInfo &Output,
+ const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
@@ -2886,11 +2883,11 @@
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath("as"));
- Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
+ C.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
void freebsd::Link::ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest, const InputInfo &Output,
+ const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
@@ -3005,14 +3002,14 @@
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath("ld"));
- Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
+ C.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
void minix::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest, const InputInfo &Output,
- const InputInfoList &Inputs,
- const ArgList &Args,
- const char *LinkingOutput) const {
+ const InputInfo &Output,
+ const InputInfoList &Inputs,
+ const ArgList &Args,
+ const char *LinkingOutput) const {
ArgStringList CmdArgs;
Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA,
@@ -3029,14 +3026,14 @@
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath("gas"));
- Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
+ C.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
void minix::Link::ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest, const InputInfo &Output,
- const InputInfoList &Inputs,
- const ArgList &Args,
- const char *LinkingOutput) const {
+ const InputInfo &Output,
+ const InputInfoList &Inputs,
+ const ArgList &Args,
+ const char *LinkingOutput) const {
const Driver &D = getToolChain().getDriver();
ArgStringList CmdArgs;
@@ -3097,7 +3094,7 @@
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath("/usr/gnu/bin/gld"));
- Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
+ C.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
/// DragonFly Tools
@@ -3105,7 +3102,7 @@
// For now, DragonFly Assemble does just about the same as for
// FreeBSD, but this may change soon.
void dragonfly::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest, const InputInfo &Output,
+ const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
@@ -3130,14 +3127,14 @@
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath("as"));
- Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
+ C.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
void dragonfly::Link::ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest, const InputInfo &Output,
- const InputInfoList &Inputs,
- const ArgList &Args,
- const char *LinkingOutput) const {
+ const InputInfo &Output,
+ const InputInfoList &Inputs,
+ const ArgList &Args,
+ const char *LinkingOutput) const {
const Driver &D = getToolChain().getDriver();
ArgStringList CmdArgs;
@@ -3263,5 +3260,5 @@
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath("ld"));
- Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
+ C.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
diff --git a/lib/Driver/Tools.h b/lib/Driver/Tools.h
index 41589aa..98bde74 100644
--- a/lib/Driver/Tools.h
+++ b/lib/Driver/Tools.h
@@ -46,7 +46,6 @@
virtual bool hasIntegratedCPP() const { return true; }
virtual void ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest,
const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &TCArgs,
@@ -64,7 +63,6 @@
virtual bool hasIntegratedCPP() const { return false; }
virtual void ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest,
const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &TCArgs,
@@ -79,7 +77,6 @@
const ToolChain &TC) : Tool(Name, ShortName, TC) {}
virtual void ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest,
const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &TCArgs,
@@ -203,7 +200,6 @@
"gcc preprocessor", TC) {}
virtual void ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest,
const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &TCArgs,
@@ -215,7 +211,6 @@
Compile(const ToolChain &TC) : CC1("darwin::Compile", "gcc frontend", TC) {}
virtual void ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest,
const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &TCArgs,
@@ -230,7 +225,6 @@
virtual bool hasIntegratedCPP() const { return false; }
virtual void ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest,
const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &TCArgs,
@@ -246,7 +240,6 @@
virtual bool hasIntegratedCPP() const { return false; }
virtual void ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest,
const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &TCArgs,
@@ -260,7 +253,6 @@
virtual bool hasIntegratedCPP() const { return false; }
virtual void ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest,
const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &TCArgs,
@@ -275,7 +267,6 @@
virtual bool hasIntegratedCPP() const { return false; }
virtual void ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest,
const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &TCArgs,
@@ -293,7 +284,6 @@
virtual bool hasIntegratedCPP() const { return false; }
virtual void ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest,
const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &TCArgs,
@@ -306,7 +296,6 @@
virtual bool hasIntegratedCPP() const { return false; }
virtual void ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest,
const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &TCArgs,
@@ -324,7 +313,6 @@
virtual bool hasIntegratedCPP() const { return false; }
virtual void ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest,
const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &TCArgs,
@@ -337,7 +325,6 @@
virtual bool hasIntegratedCPP() const { return false; }
virtual void ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest,
const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &TCArgs,
@@ -355,7 +342,6 @@
virtual bool hasIntegratedCPP() const { return false; }
virtual void ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest,
const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &TCArgs,
@@ -368,7 +354,6 @@
virtual bool hasIntegratedCPP() const { return false; }
virtual void ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest,
const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &TCArgs,
@@ -386,7 +371,6 @@
virtual bool hasIntegratedCPP() const { return false; }
virtual void ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest,
const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &TCArgs,
@@ -399,7 +383,6 @@
virtual bool hasIntegratedCPP() const { return false; }
virtual void ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest,
const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &TCArgs,
@@ -417,7 +400,6 @@
virtual bool hasIntegratedCPP() const { return false; }
virtual void ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest,
const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &TCArgs,
@@ -430,7 +412,6 @@
virtual bool hasIntegratedCPP() const { return false; }
virtual void ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest,
const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &TCArgs,