From 47ac7d27c44bd64a7d0fc03d4babc196cf2b8230 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Wed, 18 Mar 2009 06:00:36 +0000 Subject: [PATCH] Driver: Stub out Tool::ConstructJob. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67169 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Driver/Tool.h | 22 +++++++++++++++ include/clang/Driver/Util.h | 1 + lib/Driver/Driver.cpp | 5 ++-- lib/Driver/Tools.cpp | 55 +++++++++++++++++++++++++++++++++++++ lib/Driver/Tools.h | 30 ++++++++++++++++++++ 5 files changed, 111 insertions(+), 2 deletions(-) create mode 100644 lib/Driver/Tools.cpp diff --git a/include/clang/Driver/Tool.h b/include/clang/Driver/Tool.h index 06f5e37ec2..fea753e8eb 100644 --- a/include/clang/Driver/Tool.h +++ b/include/clang/Driver/Tool.h @@ -10,10 +10,20 @@ #ifndef CLANG_DRIVER_TOOL_H_ #define CLANG_DRIVER_TOOL_H_ +namespace llvm { + template class SmallVector; +} + namespace clang { namespace driver { + class ArgList; + class Compilation; + class InputInfo; + class JobAction; class ToolChain; + typedef llvm::SmallVector InputInfoList; + /// Tool - Information on a specific compilation tool. class Tool { /// The tool name (for debugging). @@ -35,6 +45,18 @@ public: virtual bool acceptsPipedInput() const = 0; virtual bool canPipeOutput() const = 0; virtual bool hasIntegratedCPP() const = 0; + + /// ConstructJob - Construct jobs to perform the action \arg JA, + /// writing to \arg Output and with \arg Inputs. + /// + /// \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, + InputInfo &Output, InputInfoList &Inputs, + const ArgList &TCArgs, + const char *LinkingOutput) const = 0; }; } // end namespace driver diff --git a/include/clang/Driver/Util.h b/include/clang/Driver/Util.h index 465d81a1f3..52f268d182 100644 --- a/include/clang/Driver/Util.h +++ b/include/clang/Driver/Util.h @@ -23,6 +23,7 @@ namespace driver { /// ActionList - Type used for lists of actions. typedef llvm::SmallVector ActionList; + } // end namespace driver } // end namespace clang diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index b41c2fa96e..a3cd55fe5f 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -706,7 +706,7 @@ void Driver::BuildJobsForAction(Compilation &C, // Only use pipes when there is exactly one input. bool TryToUsePipeInput = Inputs->size() == 1 && T.acceptsPipedInput(); - llvm::SmallVector InputInfos; + InputInfoList InputInfos; for (ActionList::const_iterator it = Inputs->begin(), ie = Inputs->end(); it != ie; ++it) { InputInfo II; @@ -768,7 +768,8 @@ void Driver::BuildJobsForAction(Compilation &C, } llvm::errs() << "], output: " << Result.getAsString() << "\n"; } else { - assert(0 && "FIXME: Make the job."); + const ArgList &TCArgs = C.getArgsForToolChain(TC); + T.ConstructJob(C, *JA, Result, InputInfos, TCArgs, LinkingOutput); } } diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp new file mode 100644 index 0000000000..f849c2beac --- /dev/null +++ b/lib/Driver/Tools.cpp @@ -0,0 +1,55 @@ +//===--- Tools.cpp - Tools Implementations ------------------------------*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "Tools.h" + +using namespace clang::driver; +using namespace clang::driver::tools; + +void Clang::ConstructJob(Compilation &C, const JobAction &JA, + InputInfo &Output, InputInfoList &Inputs, + const ArgList &TCArgs, + const char *LinkingOutput) const { + +} + +void gcc::Preprocess::ConstructJob(Compilation &C, const JobAction &JA, + InputInfo &Output, InputInfoList &Inputs, + const ArgList &TCArgs, + const char *LinkingOutput) const { + +} + +void gcc::Precompile::ConstructJob(Compilation &C, const JobAction &JA, + InputInfo &Output, InputInfoList &Inputs, + const ArgList &TCArgs, + const char *LinkingOutput) const { + +} + +void gcc::Compile::ConstructJob(Compilation &C, const JobAction &JA, + InputInfo &Output, InputInfoList &Inputs, + const ArgList &TCArgs, + const char *LinkingOutput) const { + +} + +void gcc::Assemble::ConstructJob(Compilation &C, const JobAction &JA, + InputInfo &Output, InputInfoList &Inputs, + const ArgList &TCArgs, + const char *LinkingOutput) const { + +} + +void gcc::Link::ConstructJob(Compilation &C, const JobAction &JA, + InputInfo &Output, InputInfoList &Inputs, + const ArgList &TCArgs, + const char *LinkingOutput) const { + +} diff --git a/lib/Driver/Tools.h b/lib/Driver/Tools.h index 6aaa04051f..da9d3e2ea5 100644 --- a/lib/Driver/Tools.h +++ b/lib/Driver/Tools.h @@ -25,6 +25,11 @@ namespace tools { virtual bool acceptsPipedInput() const { return true; } virtual bool canPipeOutput() const { return true; } virtual bool hasIntegratedCPP() const { return true; } + + virtual void ConstructJob(Compilation &C, const JobAction &JA, + InputInfo &Output, InputInfoList &Inputs, + const ArgList &TCArgs, + const char *LinkingOutput) const; }; /// gcc - Generic GCC tool implementations. @@ -36,6 +41,11 @@ namespace gcc { virtual bool acceptsPipedInput() const { return true; } virtual bool canPipeOutput() const { return true; } virtual bool hasIntegratedCPP() const { return false; } + + virtual void ConstructJob(Compilation &C, const JobAction &JA, + InputInfo &Output, InputInfoList &Inputs, + const ArgList &TCArgs, + const char *LinkingOutput) const; }; class VISIBILITY_HIDDEN Precompile : public Tool { @@ -45,6 +55,11 @@ namespace gcc { virtual bool acceptsPipedInput() const { return true; } virtual bool canPipeOutput() const { return false; } virtual bool hasIntegratedCPP() const { return true; } + + virtual void ConstructJob(Compilation &C, const JobAction &JA, + InputInfo &Output, InputInfoList &Inputs, + const ArgList &TCArgs, + const char *LinkingOutput) const; }; class VISIBILITY_HIDDEN Compile : public Tool { @@ -54,6 +69,11 @@ namespace gcc { virtual bool acceptsPipedInput() const { return true; } virtual bool canPipeOutput() const { return true; } virtual bool hasIntegratedCPP() const { return true; } + + virtual void ConstructJob(Compilation &C, const JobAction &JA, + InputInfo &Output, InputInfoList &Inputs, + const ArgList &TCArgs, + const char *LinkingOutput) const; }; class VISIBILITY_HIDDEN Assemble : public Tool { @@ -63,6 +83,11 @@ namespace gcc { virtual bool acceptsPipedInput() const { return true; } virtual bool canPipeOutput() const { return false; } virtual bool hasIntegratedCPP() const { return false; } + + virtual void ConstructJob(Compilation &C, const JobAction &JA, + InputInfo &Output, InputInfoList &Inputs, + const ArgList &TCArgs, + const char *LinkingOutput) const; }; class VISIBILITY_HIDDEN Link : public Tool { @@ -72,6 +97,11 @@ namespace gcc { virtual bool acceptsPipedInput() const { return false; } virtual bool canPipeOutput() const { return false; } virtual bool hasIntegratedCPP() const { return false; } + + virtual void ConstructJob(Compilation &C, const JobAction &JA, + InputInfo &Output, InputInfoList &Inputs, + const ArgList &TCArgs, + const char *LinkingOutput) const; }; } // end namespace gcc -- 2.40.0