Driver: ConstructJob also needs to know the destination (where to put
its commands). llvm-svn: 67179
This commit is contained in:
parent
3beceaf7f1
commit
04c4c2c3db
|
@ -22,6 +22,7 @@ using llvm::dyn_cast_or_null;
|
|||
|
||||
namespace clang {
|
||||
namespace driver {
|
||||
class Command;
|
||||
|
||||
class Job {
|
||||
public:
|
||||
|
@ -41,6 +42,10 @@ public:
|
|||
|
||||
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; }
|
||||
};
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ namespace driver {
|
|||
class ArgList;
|
||||
class Compilation;
|
||||
class InputInfo;
|
||||
class Job;
|
||||
class JobAction;
|
||||
class ToolChain;
|
||||
|
||||
|
@ -49,11 +50,13 @@ public:
|
|||
/// 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,
|
||||
|
|
|
@ -751,6 +751,7 @@ void Driver::BuildJobsForAction(Compilation &C,
|
|||
if (!PJ) {
|
||||
PJ = new PipedJob();
|
||||
cast<JobList>(Dest)->addJob(PJ);
|
||||
Dest = PJ;
|
||||
}
|
||||
Result = InputInfo(PJ, A->getType(), BaseInput);
|
||||
} else {
|
||||
|
@ -768,7 +769,7 @@ void Driver::BuildJobsForAction(Compilation &C,
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -21,3 +21,11 @@ Command::Command(const char *_Executable, const ArgStringList &_Arguments)
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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::Preprocess::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
}
|
||||
|
||||
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::Precompile::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
}
|
||||
|
||||
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::Compile::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
}
|
||||
|
||||
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::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
}
|
||||
|
||||
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 {
|
||||
|
|
|
@ -27,6 +27,7 @@ namespace tools {
|
|||
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 @@ namespace gcc {
|
|||
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 @@ namespace gcc {
|
|||
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 @@ namespace gcc {
|
|||
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 @@ namespace gcc {
|
|||
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 @@ namespace gcc {
|
|||
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,
|
||||
|
|
Loading…
Reference in New Issue