]> granicus.if.org Git - clang/commitdiff
Driver: Stub out Tool::ConstructJob.
authorDaniel Dunbar <daniel@zuster.org>
Wed, 18 Mar 2009 06:00:36 +0000 (06:00 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Wed, 18 Mar 2009 06:00:36 +0000 (06:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67169 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Driver/Tool.h
include/clang/Driver/Util.h
lib/Driver/Driver.cpp
lib/Driver/Tools.cpp [new file with mode: 0644]
lib/Driver/Tools.h

index 06f5e37ec270268f60ae7ad707c29e246db7277d..fea753e8ebe60b34fd3d34d18b813cbdbd4504f5 100644 (file)
 #ifndef CLANG_DRIVER_TOOL_H_
 #define CLANG_DRIVER_TOOL_H_
 
+namespace llvm {
+  template<typename T, unsigned N> class SmallVector;
+}
+
 namespace clang {
 namespace driver {
+  class ArgList;
+  class Compilation;
+  class InputInfo;
+  class JobAction;
   class ToolChain;
   
+  typedef llvm::SmallVector<InputInfo, 4> 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
index 465d81a1f383d9bcb158ee89eb46f09e668d199d..52f268d182a864c6a4850831e49815cc8b331238 100644 (file)
@@ -23,6 +23,7 @@ namespace driver {
 
   /// ActionList - Type used for lists of actions.
   typedef llvm::SmallVector<Action*, 3> ActionList;
+
 } // end namespace driver
 } // end namespace clang
 
index b41c2fa96e6c6bf0358b92fd6d3c0e64427fe45e..a3cd55fe5f5f1e6bf8f25a98eaf1992e39ea8499 100644 (file)
@@ -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<InputInfo, 4> 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 (file)
index 0000000..f849c2b
--- /dev/null
@@ -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 {
+
+}
index 6aaa04051f09f3f36f790dc9c63c2ad877c64829..da9d3e2ea5aff80e06b40204095eb62537a81f79 100644 (file)
@@ -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