]> granicus.if.org Git - clang/commitdiff
Driver: Add name to Tool (for testing/debugging) and move GCC_* tools
authorDaniel Dunbar <daniel@zuster.org>
Tue, 17 Mar 2009 22:45:24 +0000 (22:45 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Tue, 17 Mar 2009 22:45:24 +0000 (22:45 +0000)
into gcc:: namespace.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67120 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Driver/Tool.h
lib/Driver/Tool.cpp
lib/Driver/ToolChains.h
lib/Driver/Tools.h

index 28db0642585a0d69610af4f3bdc4fb2d7d5d1148..06f5e37ec270268f60ae7ad707c29e246db7277d 100644 (file)
@@ -16,14 +16,20 @@ namespace driver {
   
 /// Tool - Information on a specific compilation tool.
 class Tool {
+  /// The tool name (for debugging).
+  const char *Name;
+
+  /// The tool chain this tool is a part of.
   const ToolChain &TheToolChain;
 
 public:
-  Tool(const ToolChain &TC);
+  Tool(const char *Name, const ToolChain &TC);
 
 public:
   virtual ~Tool();
 
+  const char *getName() const { return Name; }
+
   const ToolChain &getToolChain() const { return TheToolChain; }
 
   virtual bool acceptsPipedInput() const = 0;
index 090418e3be4ef0151fd59644d92386d1ce8cb701..6f6589ab13273bf9cb0ac96f7b6fefdc50a6021c 100644 (file)
@@ -11,7 +11,8 @@
 
 using namespace clang::driver;
 
-Tool::Tool(const ToolChain &TC) : TheToolChain(TC) {
+Tool::Tool(const char *_Name, const ToolChain &TC) : Name(_Name), 
+                                                     TheToolChain(TC) {
 }
 
 Tool::~Tool() {
index c5e01ba5ac4d6a711c9b72e7b49dd31824c3a648..aa8d2a1babd6830eb5149f47f4902a45d8947c55 100644 (file)
@@ -47,17 +47,17 @@ public:
       default:
         assert(0 && "Invalid tool kind.");
       case Action::PreprocessJobClass: 
-        T = new tools::GCC_Preprocess(*this); break;
+        T = new tools::gcc::Preprocess(*this); break;
       case Action::PrecompileJobClass: 
-        T = new tools::GCC_Precompile(*this); break;
+        T = new tools::gcc::Precompile(*this); break;
       case Action::AnalyzeJobClass: 
         T = new tools::Clang(*this); break;
       case Action::CompileJobClass: 
-        T = new tools::GCC_Compile(*this); break;
+        T = new tools::gcc::Compile(*this); break;
       case Action::AssembleJobClass: 
-        T = new tools::GCC_Assemble(*this); break;
+        T = new tools::gcc::Assemble(*this); break;
       case Action::LinkJobClass: 
-        T = new tools::GCC_Assemble(*this); break;
+        T = new tools::gcc::Link(*this); break;
       }
     }
 
index 6f6b3dffbcbf4d5c9fd99e466d1a87ce26e0a620..6aaa04051f09f3f36f790dc9c63c2ad877c64829 100644 (file)
@@ -20,57 +20,60 @@ namespace tools {
 
   class VISIBILITY_HIDDEN Clang : public Tool {
   public:
-    Clang(const ToolChain &TC) : Tool(TC) {}
+    Clang(const ToolChain &TC) : Tool("clang", TC) {}
 
     virtual bool acceptsPipedInput() const { return true; }
     virtual bool canPipeOutput() const { return true; }
     virtual bool hasIntegratedCPP() const { return true; }
   };
 
-  class VISIBILITY_HIDDEN GCC_Preprocess : public Tool {
+  /// gcc - Generic GCC tool implementations.
+namespace gcc {
+  class VISIBILITY_HIDDEN Preprocess : public Tool {
   public:
-    GCC_Preprocess(const ToolChain &TC) : Tool(TC) {}
+    Preprocess(const ToolChain &TC) : Tool("gcc::Preprocess", TC) {}
 
     virtual bool acceptsPipedInput() const { return true; }
     virtual bool canPipeOutput() const { return true; }
     virtual bool hasIntegratedCPP() const { return false; }
   };
 
-  class VISIBILITY_HIDDEN GCC_Precompile : public Tool  {
+  class VISIBILITY_HIDDEN Precompile : public Tool  {
   public:
-    GCC_Precompile(const ToolChain &TC) : Tool(TC) {}
+    Precompile(const ToolChain &TC) : Tool("gcc::Precompile", TC) {}
 
     virtual bool acceptsPipedInput() const { return true; }
     virtual bool canPipeOutput() const { return false; }
     virtual bool hasIntegratedCPP() const { return true; }
   };
 
-  class VISIBILITY_HIDDEN GCC_Compile : public Tool  {
+  class VISIBILITY_HIDDEN Compile : public Tool  {
   public:
-    GCC_Compile(const ToolChain &TC) : Tool(TC) {}
+    Compile(const ToolChain &TC) : Tool("gcc::Compile", TC) {}
 
     virtual bool acceptsPipedInput() const { return true; }
     virtual bool canPipeOutput() const { return true; }
     virtual bool hasIntegratedCPP() const { return true; }
   };
 
-  class VISIBILITY_HIDDEN GCC_Assemble : public Tool  {
+  class VISIBILITY_HIDDEN Assemble : public Tool  {
   public:
-    GCC_Assemble(const ToolChain &TC) : Tool(TC) {}
+    Assemble(const ToolChain &TC) : Tool("gcc::Assemble", TC) {}
 
     virtual bool acceptsPipedInput() const { return true; }
     virtual bool canPipeOutput() const { return false; }
     virtual bool hasIntegratedCPP() const { return false; }
   };
 
-  class VISIBILITY_HIDDEN GCC_Link : public Tool  {
+  class VISIBILITY_HIDDEN Link : public Tool  {
   public:
-    GCC_Link(const ToolChain &TC) : Tool(TC) {}
+    Link(const ToolChain &TC) : Tool("gcc::Link", TC) {}
 
     virtual bool acceptsPipedInput() const { return false; }
     virtual bool canPipeOutput() const { return false; }
     virtual bool hasIntegratedCPP() const { return false; }
   };
+} // end namespace gcc
 
 } // end namespace toolchains
 } // end namespace driver