[cfe-commits] r74627 - in /cfe/trunk: include/clang/Driver/Job.h lib/Driver/Job.cpp lib/Driver/Tools.cpp
Daniel Dunbar
daniel at zuster.org
Wed Jul 1 12:02:29 PDT 2009
Author: ddunbar
Date: Wed Jul 1 14:02:28 2009
New Revision: 74627
URL: http://llvm.org/viewvc/llvm-project?rev=74627&view=rev
Log:
Driver: Add Source argument for Commands to hold the Action which caused a
Command to be generated, to support more advanced diagnostics.
- No functionality change.
Modified:
cfe/trunk/include/clang/Driver/Job.h
cfe/trunk/lib/Driver/Job.cpp
cfe/trunk/lib/Driver/Tools.cpp
Modified: cfe/trunk/include/clang/Driver/Job.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Job.h?rev=74627&r1=74626&r2=74627&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Job.h (original)
+++ cfe/trunk/include/clang/Driver/Job.h Wed Jul 1 14:02:28 2009
@@ -52,6 +52,9 @@
/// Command - An executable path/name and argument vector to
/// execute.
class Command : public Job {
+ /// Source - The action which caused the creation of this job.
+ const Action &Source;
+
/// The executable to run.
const char *Executable;
@@ -60,9 +63,14 @@
ArgStringList Arguments;
public:
- Command(const char *_Executable, const ArgStringList &_Arguments);
+ Command(const Action &_Source, const char *_Executable,
+ const ArgStringList &_Arguments);
+
+ /// getSource - Return the Action which caused the creation of this job.
+ const Action &getSource() const { return Source; }
const char *getExecutable() const { return Executable; }
+
const ArgStringList &getArguments() const { return Arguments; }
static bool classof(const Job *J) {
Modified: cfe/trunk/lib/Driver/Job.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Job.cpp?rev=74627&r1=74626&r2=74627&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Job.cpp (original)
+++ cfe/trunk/lib/Driver/Job.cpp Wed Jul 1 14:02:28 2009
@@ -14,8 +14,10 @@
Job::~Job() {}
-Command::Command(const char *_Executable, const ArgStringList &_Arguments)
- : Job(CommandClass), Executable(_Executable), Arguments(_Arguments) {
+Command::Command(const Action &_Source, const char *_Executable,
+ const ArgStringList &_Arguments)
+ : Job(CommandClass), Source(_Source), Executable(_Executable),
+ Arguments(_Arguments) {
}
PipedJob::PipedJob() : Job(PipedJobClass) {}
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=74627&r1=74626&r2=74627&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Jul 1 14:02:28 2009
@@ -628,7 +628,7 @@
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(C, "clang-cc").c_str());
- Dest.addCommand(new Command(Exec, CmdArgs));
+ Dest.addCommand(new Command(JA, Exec, CmdArgs));
// Explicitly warn that these options are unsupported, even though
// we are allowing compilation to continue.
@@ -759,7 +759,7 @@
getToolChain().getHost().getDriver().CCCGenericGCCName.c_str();
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(C, GCCName).c_str());
- Dest.addCommand(new Command(Exec, CmdArgs));
+ Dest.addCommand(new Command(JA, Exec, CmdArgs));
}
void gcc::Preprocess::RenderExtraToolArgs(ArgStringList &CmdArgs) const {
@@ -1135,7 +1135,7 @@
const char *CC1Name = getCC1Name(Inputs[0].getType());
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(C, CC1Name).c_str());
- Dest.addCommand(new Command(Exec, CmdArgs));
+ Dest.addCommand(new Command(JA, Exec, CmdArgs));
}
void darwin::Compile::ConstructJob(Compilation &C, const JobAction &JA,
@@ -1223,7 +1223,7 @@
const char *CC1Name = getCC1Name(Inputs[0].getType());
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(C, CC1Name).c_str());
- Dest.addCommand(new Command(Exec, CmdArgs));
+ Dest.addCommand(new Command(JA, Exec, CmdArgs));
}
void darwin::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
@@ -1276,7 +1276,7 @@
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(C, "as").c_str());
- Dest.addCommand(new Command(Exec, CmdArgs));
+ Dest.addCommand(new Command(JA, Exec, CmdArgs));
}
/// Helper routine for seeing if we should use dsymutil; this is a
@@ -1700,7 +1700,7 @@
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(C, "ld").c_str());
- Dest.addCommand(new Command(Exec, CmdArgs));
+ Dest.addCommand(new Command(JA, Exec, CmdArgs));
// Find the first non-empty base input (we want to ignore linker
// inputs).
@@ -1730,7 +1730,7 @@
Args.MakeArgString(getToolChain().GetProgramPath(C, "dsymutil").c_str());
ArgStringList CmdArgs;
CmdArgs.push_back(Output.getFilename());
- C.getJobs().addCommand(new Command(Exec, CmdArgs));
+ C.getJobs().addCommand(new Command(JA, Exec, CmdArgs));
}
}
}
@@ -1756,7 +1756,7 @@
}
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(C, "lipo").c_str());
- Dest.addCommand(new Command(Exec, CmdArgs));
+ Dest.addCommand(new Command(JA, Exec, CmdArgs));
}
void openbsd::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
@@ -1787,7 +1787,7 @@
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(C, "as").c_str());
- Dest.addCommand(new Command(Exec, CmdArgs));
+ Dest.addCommand(new Command(JA, Exec, CmdArgs));
}
void openbsd::Link::ConstructJob(Compilation &C, const JobAction &JA,
@@ -1869,7 +1869,7 @@
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(C, "ld").c_str());
- Dest.addCommand(new Command(Exec, CmdArgs));
+ Dest.addCommand(new Command(JA, Exec, CmdArgs));
}
void freebsd::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
@@ -1905,7 +1905,7 @@
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(C, "as").c_str());
- Dest.addCommand(new Command(Exec, CmdArgs));
+ Dest.addCommand(new Command(JA, Exec, CmdArgs));
}
void freebsd::Link::ConstructJob(Compilation &C, const JobAction &JA,
@@ -2016,7 +2016,7 @@
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(C, "ld").c_str());
- Dest.addCommand(new Command(Exec, CmdArgs));
+ Dest.addCommand(new Command(JA, Exec, CmdArgs));
}
/// DragonFly Tools
@@ -2055,7 +2055,7 @@
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(C, "as").c_str());
- Dest.addCommand(new Command(Exec, CmdArgs));
+ Dest.addCommand(new Command(JA, Exec, CmdArgs));
}
void dragonfly::Link::ConstructJob(Compilation &C, const JobAction &JA,
@@ -2179,5 +2179,5 @@
const char *Exec =
Args.MakeArgString(getToolChain().GetProgramPath(C, "ld").c_str());
- Dest.addCommand(new Command(Exec, CmdArgs));
+ Dest.addCommand(new Command(JA, Exec, CmdArgs));
}
More information about the cfe-commits
mailing list