[cfe-commits] r67169 - in /cfe/trunk: include/clang/Driver/Tool.h include/clang/Driver/Util.h lib/Driver/Driver.cpp lib/Driver/Tools.cpp lib/Driver/Tools.h

Daniel Dunbar daniel at zuster.org
Tue Mar 17 23:00:36 PDT 2009


Author: ddunbar
Date: Wed Mar 18 01:00:36 2009
New Revision: 67169

URL: http://llvm.org/viewvc/llvm-project?rev=67169&view=rev
Log:
Driver: Stub out Tool::ConstructJob.

Added:
    cfe/trunk/lib/Driver/Tools.cpp
Modified:
    cfe/trunk/include/clang/Driver/Tool.h
    cfe/trunk/include/clang/Driver/Util.h
    cfe/trunk/lib/Driver/Driver.cpp
    cfe/trunk/lib/Driver/Tools.h

Modified: cfe/trunk/include/clang/Driver/Tool.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Tool.h?rev=67169&r1=67168&r2=67169&view=diff

==============================================================================
--- cfe/trunk/include/clang/Driver/Tool.h (original)
+++ cfe/trunk/include/clang/Driver/Tool.h Wed Mar 18 01:00:36 2009
@@ -10,10 +10,20 @@
 #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 @@
   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

Modified: cfe/trunk/include/clang/Driver/Util.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Util.h?rev=67169&r1=67168&r2=67169&view=diff

==============================================================================
--- cfe/trunk/include/clang/Driver/Util.h (original)
+++ cfe/trunk/include/clang/Driver/Util.h Wed Mar 18 01:00:36 2009
@@ -23,6 +23,7 @@
 
   /// ActionList - Type used for lists of actions.
   typedef llvm::SmallVector<Action*, 3> ActionList;
+
 } // end namespace driver
 } // end namespace clang
 

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=67169&r1=67168&r2=67169&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Wed Mar 18 01:00:36 2009
@@ -706,7 +706,7 @@
 
   // 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 @@
     }
     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);
   }
 }
 

Added: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=67169&view=auto

==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (added)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Mar 18 01:00:36 2009
@@ -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 {
+
+}

Modified: cfe/trunk/lib/Driver/Tools.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.h?rev=67169&r1=67168&r2=67169&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/Tools.h (original)
+++ cfe/trunk/lib/Driver/Tools.h Wed Mar 18 01:00:36 2009
@@ -25,6 +25,11 @@
     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 @@
     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 @@
     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 @@
     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 @@
     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 @@
     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
 





More information about the cfe-commits mailing list