[driver] Reworked Driver::buildJobsForAction() so that it doesn’t create the same Job multiple times.

Since a Job may be reached through multiple paths in the dependency graph, we
need to include support for caching Jobs. (Currently, the cache maps
Action/ToolChain pairs to Jobs.)

As a result of these changes, Tool::constructJob() and
Driver::buildJobsForAction() return a plain Job *, instead of a
std::unique_ptr<Job>, since the Jobs returned by buildJobsForAction() no longer
need to be unique.

Swift SVN r12443
This commit is contained in:
Connor Wakamo
2014-01-17 00:47:21 +00:00
parent 31df3cb241
commit 40b38c40b2
5 changed files with 71 additions and 57 deletions

View File

@@ -34,13 +34,12 @@ public:
virtual bool hasGoodDiagnostics() const { return true; }
virtual std::unique_ptr<Job>
constructJob(const JobAction &JA,
std::unique_ptr<JobList> Inputs,
std::unique_ptr<CommandOutput> Output,
const ActionList &InputActions,
const llvm::opt::ArgList &Args,
StringRef LinkingOutput) const;
virtual Job *constructJob(const JobAction &JA,
std::unique_ptr<JobList> Inputs,
std::unique_ptr<CommandOutput> Output,
const ActionList &InputActions,
const llvm::opt::ArgList &Args,
StringRef LinkingOutput) const;
};
namespace darwin {
@@ -67,13 +66,12 @@ class LLVM_LIBRARY_VISIBILITY Linker : public DarwinTool {
public:
Linker(const ToolChain &TC) : DarwinTool("darwin::Linker", "linker", TC) {}
virtual std::unique_ptr<Job>
constructJob(const JobAction &JA,
std::unique_ptr<JobList> Inputs,
std::unique_ptr<CommandOutput> Output,
const ActionList &InputActions,
const llvm::opt::ArgList &Args,
StringRef LinkingOutput) const;
virtual Job *constructJob(const JobAction &JA,
std::unique_ptr<JobList> Inputs,
std::unique_ptr<CommandOutput> Output,
const ActionList &InputActions,
const llvm::opt::ArgList &Args,
StringRef LinkingOutput) const;
};
} // end namespace darwin