[cfe-commits] r67179 - in /cfe/trunk: include/clang/Driver/Job.h include/clang/Driver/Tool.h lib/Driver/Driver.cpp lib/Driver/InputInfo.h lib/Driver/Job.cpp lib/Driver/Tools.cpp lib/Driver/Tools.h
Daniel Dunbar
daniel at zuster.org
Wed Mar 18 00:06:02 PDT 2009
Author: ddunbar
Date: Wed Mar 18 02:06:02 2009
New Revision: 67179
URL: http://llvm.org/viewvc/llvm-project?rev=67179&view=rev
Log:
Driver: ConstructJob also needs to know the destination (where to put
its commands).
Modified:
cfe/trunk/include/clang/Driver/Job.h
cfe/trunk/include/clang/Driver/Tool.h
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/InputInfo.h
cfe/trunk/lib/Driver/Job.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Driver/Tools.h
Modified: cfe/trunk/include/clang/Driver/Job.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Job.h?rev=67179&r1=67178&r2=67179&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Job.h (original)
+++ cfe/trunk/include/clang/Driver/Job.h Wed Mar 18 02:06:02 2009
@@ -22,6 +22,7 @@
namespace clang {
namespace driver {
+ class Command;
class Job {
public:
@@ -41,6 +42,10 @@
JobClass getKind() const { return Kind; }
+ /// addCommand - Append a command to the current job, which must be
+ /// either a piped job or a job list.
+ void addCommand(Command *C);
+
static bool classof(const Job *) { return true; }
};
Modified: cfe/trunk/include/clang/Driver/Tool.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Tool.h?rev=67179&r1=67178&r2=67179&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Tool.h (original)
+++ cfe/trunk/include/clang/Driver/Tool.h Wed Mar 18 02:06:02 2009
@@ -19,6 +19,7 @@
class ArgList;
class Compilation;
class InputInfo;
+ class Job;
class JobAction;
class ToolChain;
@@ -49,11 +50,13 @@
/// 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,
Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=67179&r1=67178&r2=67179&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Wed Mar 18 02:06:02 2009
@@ -751,6 +751,7 @@
if (!PJ) {
PJ = new PipedJob();
cast<JobList>(Dest)->addJob(PJ);
+ Dest = PJ;
}
Result = InputInfo(PJ, A->getType(), BaseInput);
} else {
@@ -768,7 +769,7 @@
llvm::errs() << "], output: " << Result.getAsString() << "\n";
} else {
const ArgList &TCArgs = C.getArgsForToolChain(TC);
- T.ConstructJob(C, *JA, Result, InputInfos, TCArgs, LinkingOutput);
+ T.ConstructJob(C, *JA, *Dest, Result, InputInfos, TCArgs, LinkingOutput);
}
}
Modified: cfe/trunk/lib/Driver/InputInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/InputInfo.h?rev=67179&r1=67178&r2=67179&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/InputInfo.h (original)
+++ cfe/trunk/lib/Driver/InputInfo.h Wed Mar 18 02:06:02 2009
@@ -10,6 +10,8 @@
#ifndef CLANG_LIB_DRIVER_INPUTINFO_H_
#define CLANG_LIB_DRIVER_INPUTINFO_H_
+#include "clang/Driver/Types.h"
+
#include <cassert>
#include <string>
Modified: cfe/trunk/lib/Driver/Job.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Job.cpp?rev=67179&r1=67178&r2=67179&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Job.cpp (original)
+++ cfe/trunk/lib/Driver/Job.cpp Wed Mar 18 02:06:02 2009
@@ -21,3 +21,11 @@
PipedJob::PipedJob() : Job(PipedJobClass) {}
JobList::JobList() : Job(JobListClass) {}
+
+void Job::addCommand(Command *C) {
+ if (PipedJob *PJ = dyn_cast<PipedJob>(this))
+ PJ->addCommand(C);
+ else
+ cast<JobList>(this)->addJob(C);
+}
+
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=67179&r1=67178&r2=67179&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Mar 18 02:06:02 2009
@@ -9,18 +9,29 @@
#include "Tools.h"
+#include "clang/Driver/Arg.h"
+#include "clang/Driver/Compilation.h"
+#include "clang/Driver/Job.h"
+#include "clang/Driver/Util.h"
+
+#include "llvm/ADT/SmallVector.h"
+
+#include "InputInfo.h"
+
using namespace clang::driver;
using namespace clang::driver::tools;
void Clang::ConstructJob(Compilation &C, const JobAction &JA,
- const InputInfo &Output,
+ Job &Dest,
+ const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &TCArgs,
const char *LinkingOutput) const {
}
void gcc::Preprocess::ConstructJob(Compilation &C, const JobAction &JA,
- const InputInfo &Output,
+ Job &Dest,
+ const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &TCArgs,
const char *LinkingOutput) const {
@@ -28,7 +39,8 @@
}
void gcc::Precompile::ConstructJob(Compilation &C, const JobAction &JA,
- const InputInfo &Output,
+ Job &Dest,
+ const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &TCArgs,
const char *LinkingOutput) const {
@@ -36,7 +48,8 @@
}
void gcc::Compile::ConstructJob(Compilation &C, const JobAction &JA,
- const InputInfo &Output,
+ Job &Dest,
+ const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &TCArgs,
const char *LinkingOutput) const {
@@ -44,7 +57,8 @@
}
void gcc::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
- const InputInfo &Output,
+ Job &Dest,
+ const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &TCArgs,
const char *LinkingOutput) const {
@@ -52,7 +66,8 @@
}
void gcc::Link::ConstructJob(Compilation &C, const JobAction &JA,
- const InputInfo &Output,
+ Job &Dest,
+ const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &TCArgs,
const char *LinkingOutput) const {
Modified: cfe/trunk/lib/Driver/Tools.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.h?rev=67179&r1=67178&r2=67179&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.h (original)
+++ cfe/trunk/lib/Driver/Tools.h Wed Mar 18 02:06:02 2009
@@ -27,6 +27,7 @@
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,
@@ -44,6 +45,7 @@
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,
@@ -59,6 +61,7 @@
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,
@@ -74,6 +77,7 @@
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,
@@ -89,6 +93,7 @@
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,
@@ -104,6 +109,7 @@
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,
More information about the cfe-commits
mailing list