Driver: Add Command::Creator member variable, which tracks the tool that was

used to create a particular command.

llvm-svn: 90287
This commit is contained in:
Daniel Dunbar 2009-12-02 03:23:25 +00:00
parent 037bcb5be3
commit 120c77e4e9
3 changed files with 30 additions and 22 deletions

View File

@ -22,7 +22,8 @@ using llvm::dyn_cast_or_null;
namespace clang {
namespace driver {
class Command;
class Command;
class Tool;
class Job {
public:
@ -55,6 +56,9 @@ class Command : public Job {
/// Source - The action which caused the creation of this job.
const Action &Source;
/// Tool - The tool which caused the creation of this job.
const Tool &Creator;
/// The executable to run.
const char *Executable;
@ -63,12 +67,15 @@ class Command : public Job {
ArgStringList Arguments;
public:
Command(const Action &_Source, const char *_Executable,
Command(const Action &_Source, const Tool &_Creator, const char *_Executable,
const ArgStringList &_Arguments);
/// getSource - Return the Action which caused the creation of this job.
const Action &getSource() const { return Source; }
/// getCreator - Return the Tool which caused the creation of this job.
const Tool &getCreator() const { return Creator; }
const char *getExecutable() const { return Executable; }
const ArgStringList &getArguments() const { return Arguments; }

View File

@ -14,10 +14,11 @@ using namespace clang::driver;
Job::~Job() {}
Command::Command(const Action &_Source, const char *_Executable,
const ArgStringList &_Arguments)
: Job(CommandClass), Source(_Source), Executable(_Executable),
Arguments(_Arguments) {
Command::Command(const Action &_Source, const Tool &_Creator,
const char *_Executable, const ArgStringList &_Arguments)
: Job(CommandClass), Source(_Source), Creator(_Creator),
Executable(_Executable), Arguments(_Arguments)
{
}
PipedJob::PipedJob() : Job(PipedJobClass) {}

View File

@ -1078,7 +1078,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(C, "clang-cc"));
Dest.addCommand(new Command(JA, Exec, CmdArgs));
Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
// Explicitly warn that these options are unsupported, even though
// we are allowing compilation to continue.
@ -1200,7 +1200,7 @@ void gcc::Common::ConstructJob(Compilation &C, const JobAction &JA,
getToolChain().getHost().getDriver().CCCGenericGCCName.c_str();
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(C, GCCName));
Dest.addCommand(new Command(JA, Exec, CmdArgs));
Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
void gcc::Preprocess::RenderExtraToolArgs(ArgStringList &CmdArgs) const {
@ -1589,7 +1589,7 @@ void darwin::Preprocess::ConstructJob(Compilation &C, const JobAction &JA,
const char *CC1Name = getCC1Name(Inputs[0].getType());
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(C, CC1Name));
Dest.addCommand(new Command(JA, Exec, CmdArgs));
Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
void darwin::Compile::ConstructJob(Compilation &C, const JobAction &JA,
@ -1683,7 +1683,7 @@ void darwin::Compile::ConstructJob(Compilation &C, const JobAction &JA,
const char *CC1Name = getCC1Name(Inputs[0].getType());
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(C, CC1Name));
Dest.addCommand(new Command(JA, Exec, CmdArgs));
Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
void darwin::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
@ -1738,7 +1738,7 @@ void darwin::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(C, "as"));
Dest.addCommand(new Command(JA, Exec, CmdArgs));
Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
/// Helper routine for seeing if we should use dsymutil; this is a
@ -2152,7 +2152,7 @@ void darwin::Link::ConstructJob(Compilation &C, const JobAction &JA,
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(C, "ld"));
Dest.addCommand(new Command(JA, Exec, CmdArgs));
Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
// Find the first non-empty base input (we want to ignore linker
// inputs).
@ -2182,7 +2182,7 @@ void darwin::Link::ConstructJob(Compilation &C, const JobAction &JA,
Args.MakeArgString(getToolChain().GetProgramPath(C, "dsymutil"));
ArgStringList CmdArgs;
CmdArgs.push_back(Output.getFilename());
C.getJobs().addCommand(new Command(JA, Exec, CmdArgs));
C.getJobs().addCommand(new Command(JA, *this, Exec, CmdArgs));
}
}
}
@ -2208,7 +2208,7 @@ void darwin::Lipo::ConstructJob(Compilation &C, const JobAction &JA,
}
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(C, "lipo"));
Dest.addCommand(new Command(JA, Exec, CmdArgs));
Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
void auroraux::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
@ -2238,7 +2238,7 @@ void auroraux::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(C, "gas"));
Dest.addCommand(new Command(JA, Exec, CmdArgs));
Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
void auroraux::Link::ConstructJob(Compilation &C, const JobAction &JA,
@ -2339,7 +2339,7 @@ void auroraux::Link::ConstructJob(Compilation &C, const JobAction &JA,
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(C, "ld"));
Dest.addCommand(new Command(JA, Exec, CmdArgs));
Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
void openbsd::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
@ -2369,7 +2369,7 @@ void openbsd::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(C, "as"));
Dest.addCommand(new Command(JA, Exec, CmdArgs));
Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
void openbsd::Link::ConstructJob(Compilation &C, const JobAction &JA,
@ -2469,7 +2469,7 @@ void openbsd::Link::ConstructJob(Compilation &C, const JobAction &JA,
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(C, "ld"));
Dest.addCommand(new Command(JA, Exec, CmdArgs));
Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
void freebsd::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
@ -2504,7 +2504,7 @@ void freebsd::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(C, "as"));
Dest.addCommand(new Command(JA, Exec, CmdArgs));
Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
void freebsd::Link::ConstructJob(Compilation &C, const JobAction &JA,
@ -2617,7 +2617,7 @@ void freebsd::Link::ConstructJob(Compilation &C, const JobAction &JA,
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(C, "ld"));
Dest.addCommand(new Command(JA, Exec, CmdArgs));
Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
/// DragonFly Tools
@ -2656,7 +2656,7 @@ void dragonfly::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(C, "as"));
Dest.addCommand(new Command(JA, Exec, CmdArgs));
Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
void dragonfly::Link::ConstructJob(Compilation &C, const JobAction &JA,
@ -2780,5 +2780,5 @@ void dragonfly::Link::ConstructJob(Compilation &C, const JobAction &JA,
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(C, "ld"));
Dest.addCommand(new Command(JA, Exec, CmdArgs));
Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
}