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

Daniel Dunbar daniel at zuster.org
Fri May 21 17:37:18 PDT 2010


Author: ddunbar
Date: Fri May 21 19:37:18 2010
New Revision: 104416

URL: http://llvm.org/viewvc/llvm-project?rev=104416&view=rev
Log:
Driver: Add Tool::ShortName, intended to be a human readable name for the tool.

Modified:
    cfe/trunk/include/clang/Driver/Tool.h
    cfe/trunk/lib/Driver/Tool.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=104416&r1=104415&r2=104416&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Tool.h (original)
+++ cfe/trunk/include/clang/Driver/Tool.h Fri May 21 19:37:18 2010
@@ -30,17 +30,23 @@
   /// The tool name (for debugging).
   const char *Name;
 
+  /// The human readable name for the tool, for use in diagnostics.
+  const char *ShortName;
+
   /// The tool chain this tool is a part of.
   const ToolChain &TheToolChain;
 
 public:
-  Tool(const char *Name, const ToolChain &TC);
+  Tool(const char *Name, const char *ShortName,
+       const ToolChain &TC);
 
 public:
   virtual ~Tool();
 
   const char *getName() const { return Name; }
 
+  const char *getShortName() const { return ShortName; }
+
   const ToolChain &getToolChain() const { return TheToolChain; }
 
   virtual bool acceptsPipedInput() const = 0;

Modified: cfe/trunk/lib/Driver/Tool.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tool.cpp?rev=104416&r1=104415&r2=104416&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tool.cpp (original)
+++ cfe/trunk/lib/Driver/Tool.cpp Fri May 21 19:37:18 2010
@@ -11,8 +11,10 @@
 
 using namespace clang::driver;
 
-Tool::Tool(const char *_Name, const ToolChain &TC) : Name(_Name),
-                                                     TheToolChain(TC) {
+Tool::Tool(const char *_Name, const char *_ShortName,
+           const ToolChain &TC) : Name(_Name), ShortName(_ShortName),
+                                  TheToolChain(TC)
+{
 }
 
 Tool::~Tool() {

Modified: cfe/trunk/lib/Driver/Tools.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.h?rev=104416&r1=104415&r2=104416&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.h (original)
+++ cfe/trunk/lib/Driver/Tools.h Fri May 21 19:37:18 2010
@@ -39,7 +39,7 @@
     void AddX86TargetArgs(const ArgList &Args, ArgStringList &CmdArgs) const;
 
   public:
-    Clang(const ToolChain &TC) : Tool("clang", TC) {}
+    Clang(const ToolChain &TC) : Tool("clang", "clang frontend", TC) {}
 
     virtual bool acceptsPipedInput() const { return true; }
     virtual bool canPipeOutput() const { return true; }
@@ -58,7 +58,8 @@
   /// \brief Clang integrated assembler tool.
   class LLVM_LIBRARY_VISIBILITY ClangAs : public Tool {
   public:
-    ClangAs(const ToolChain &TC) : Tool("clang::as", TC) {}
+    ClangAs(const ToolChain &TC) : Tool("clang::as",
+                                        "clang integrated assembler", TC) {}
 
     virtual bool acceptsPipedInput() const { return true; }
     virtual bool canPipeOutput() const { return true; }
@@ -78,7 +79,8 @@
 namespace gcc {
   class LLVM_LIBRARY_VISIBILITY Common : public Tool {
   public:
-    Common(const char *Name, const ToolChain &TC) : Tool(Name, TC) {}
+    Common(const char *Name, const char *ShortName,
+           const ToolChain &TC) : Tool(Name, ShortName, TC) {}
 
     virtual void ConstructJob(Compilation &C, const JobAction &JA,
                               Job &Dest,
@@ -96,7 +98,8 @@
 
   class LLVM_LIBRARY_VISIBILITY Preprocess : public Common {
   public:
-    Preprocess(const ToolChain &TC) : Common("gcc::Preprocess", TC) {}
+    Preprocess(const ToolChain &TC) : Common("gcc::Preprocess",
+                                             "gcc preprocessor", TC) {}
 
     virtual bool acceptsPipedInput() const { return true; }
     virtual bool canPipeOutput() const { return true; }
@@ -109,7 +112,8 @@
 
   class LLVM_LIBRARY_VISIBILITY Precompile : public Common  {
   public:
-    Precompile(const ToolChain &TC) : Common("gcc::Precompile", TC) {}
+    Precompile(const ToolChain &TC) : Common("gcc::Precompile",
+                                             "gcc precompile", TC) {}
 
     virtual bool acceptsPipedInput() const { return true; }
     virtual bool canPipeOutput() const { return false; }
@@ -122,7 +126,8 @@
 
   class LLVM_LIBRARY_VISIBILITY Compile : public Common  {
   public:
-    Compile(const ToolChain &TC) : Common("gcc::Compile", TC) {}
+    Compile(const ToolChain &TC) : Common("gcc::Compile",
+                                          "gcc frontend", TC) {}
 
     virtual bool acceptsPipedInput() const { return true; }
     virtual bool canPipeOutput() const { return true; }
@@ -135,7 +140,8 @@
 
   class LLVM_LIBRARY_VISIBILITY Assemble : public Common  {
   public:
-    Assemble(const ToolChain &TC) : Common("gcc::Assemble", TC) {}
+    Assemble(const ToolChain &TC) : Common("gcc::Assemble",
+                                           "assembler (via gcc)", TC) {}
 
     virtual bool acceptsPipedInput() const { return true; }
     virtual bool canPipeOutput() const { return false; }
@@ -147,7 +153,8 @@
 
   class LLVM_LIBRARY_VISIBILITY Link : public Common  {
   public:
-    Link(const ToolChain &TC) : Common("gcc::Link", TC) {}
+    Link(const ToolChain &TC) : Common("gcc::Link",
+                                       "linker (via gcc)", TC) {}
 
     virtual bool acceptsPipedInput() const { return false; }
     virtual bool canPipeOutput() const { return false; }
@@ -168,7 +175,8 @@
     }
 
   public:
-    DarwinTool(const char *Name, const ToolChain &TC) : Tool(Name, TC) {}
+    DarwinTool(const char *Name, const char *ShortName,
+               const ToolChain &TC) : Tool(Name, ShortName, TC) {}
   };
 
   class LLVM_LIBRARY_VISIBILITY CC1 : public DarwinTool  {
@@ -196,7 +204,8 @@
     void AddCPPArgs(const ArgList &Args, ArgStringList &CmdArgs) const;
 
   public:
-    CC1(const char *Name, const ToolChain &TC) : DarwinTool(Name, TC) {}
+    CC1(const char *Name, const char *ShortName,
+        const ToolChain &TC) : DarwinTool(Name, ShortName, TC) {}
 
     virtual bool acceptsPipedInput() const { return true; }
     virtual bool canPipeOutput() const { return true; }
@@ -206,7 +215,8 @@
 
   class LLVM_LIBRARY_VISIBILITY Preprocess : public CC1  {
   public:
-    Preprocess(const ToolChain &TC) : CC1("darwin::Preprocess", TC) {}
+    Preprocess(const ToolChain &TC) : CC1("darwin::Preprocess",
+                                          "gcc preprocessor", TC) {}
 
     virtual void ConstructJob(Compilation &C, const JobAction &JA,
                               Job &Dest,
@@ -218,7 +228,7 @@
 
   class LLVM_LIBRARY_VISIBILITY Compile : public CC1  {
   public:
-    Compile(const ToolChain &TC) : CC1("darwin::Compile", TC) {}
+    Compile(const ToolChain &TC) : CC1("darwin::Compile", "gcc frontend", TC) {}
 
     virtual void ConstructJob(Compilation &C, const JobAction &JA,
                               Job &Dest,
@@ -230,7 +240,8 @@
 
   class LLVM_LIBRARY_VISIBILITY Assemble : public DarwinTool  {
   public:
-    Assemble(const ToolChain &TC) : DarwinTool("darwin::Assemble", TC) {}
+    Assemble(const ToolChain &TC) : DarwinTool("darwin::Assemble",
+                                               "assembler", TC) {}
 
     virtual bool acceptsPipedInput() const { return true; }
     virtual bool canPipeOutput() const { return false; }
@@ -248,7 +259,7 @@
     void AddLinkArgs(const ArgList &Args, ArgStringList &CmdArgs) const;
 
   public:
-    Link(const ToolChain &TC) : DarwinTool("darwin::Link", TC) {}
+    Link(const ToolChain &TC) : DarwinTool("darwin::Link", "linker", TC) {}
 
     virtual bool acceptsPipedInput() const { return false; }
     virtual bool canPipeOutput() const { return false; }
@@ -264,7 +275,7 @@
 
   class LLVM_LIBRARY_VISIBILITY Lipo : public DarwinTool  {
   public:
-    Lipo(const ToolChain &TC) : DarwinTool("darwin::Lipo", TC) {}
+    Lipo(const ToolChain &TC) : DarwinTool("darwin::Lipo", "lipo", TC) {}
 
     virtual bool acceptsPipedInput() const { return false; }
     virtual bool canPipeOutput() const { return false; }
@@ -283,7 +294,8 @@
 namespace openbsd {
   class LLVM_LIBRARY_VISIBILITY Assemble : public Tool  {
   public:
-    Assemble(const ToolChain &TC) : Tool("openbsd::Assemble", TC) {}
+    Assemble(const ToolChain &TC) : Tool("openbsd::Assemble", "assembler",
+                                         TC) {}
 
     virtual bool acceptsPipedInput() const { return true; }
     virtual bool canPipeOutput() const { return true; }
@@ -298,7 +310,7 @@
   };
   class LLVM_LIBRARY_VISIBILITY Link : public Tool  {
   public:
-    Link(const ToolChain &TC) : Tool("openbsd::Link", TC) {}
+    Link(const ToolChain &TC) : Tool("openbsd::Link", "linker", TC) {}
 
     virtual bool acceptsPipedInput() const { return true; }
     virtual bool canPipeOutput() const { return true; }
@@ -317,7 +329,8 @@
 namespace freebsd {
   class LLVM_LIBRARY_VISIBILITY Assemble : public Tool  {
   public:
-    Assemble(const ToolChain &TC) : Tool("freebsd::Assemble", TC) {}
+    Assemble(const ToolChain &TC) : Tool("freebsd::Assemble", "assembler",
+                                         TC) {}
 
     virtual bool acceptsPipedInput() const { return true; }
     virtual bool canPipeOutput() const { return true; }
@@ -332,7 +345,7 @@
   };
   class LLVM_LIBRARY_VISIBILITY Link : public Tool  {
   public:
-    Link(const ToolChain &TC) : Tool("freebsd::Link", TC) {}
+    Link(const ToolChain &TC) : Tool("freebsd::Link", "linker", TC) {}
 
     virtual bool acceptsPipedInput() const { return true; }
     virtual bool canPipeOutput() const { return true; }
@@ -351,7 +364,8 @@
 namespace auroraux {
   class LLVM_LIBRARY_VISIBILITY Assemble : public Tool  {
   public:
-    Assemble(const ToolChain &TC) : Tool("auroraux::Assemble", TC) {}
+    Assemble(const ToolChain &TC) : Tool("auroraux::Assemble", "assembler",
+                                         TC) {}
 
     virtual bool acceptsPipedInput() const { return true; }
     virtual bool canPipeOutput() const { return true; }
@@ -366,7 +380,7 @@
   };
   class LLVM_LIBRARY_VISIBILITY Link : public Tool  {
   public:
-    Link(const ToolChain &TC) : Tool("auroraux::Link", TC) {}
+    Link(const ToolChain &TC) : Tool("auroraux::Link", "linker", TC) {}
 
     virtual bool acceptsPipedInput() const { return true; }
     virtual bool canPipeOutput() const { return true; }
@@ -385,7 +399,8 @@
 namespace dragonfly {
   class LLVM_LIBRARY_VISIBILITY Assemble : public Tool  {
   public:
-    Assemble(const ToolChain &TC) : Tool("dragonfly::Assemble", TC) {}
+    Assemble(const ToolChain &TC) : Tool("dragonfly::Assemble", "assembler",
+                                         TC) {}
 
     virtual bool acceptsPipedInput() const { return true; }
     virtual bool canPipeOutput() const { return true; }
@@ -400,7 +415,7 @@
   };
   class LLVM_LIBRARY_VISIBILITY Link : public Tool  {
   public:
-    Link(const ToolChain &TC) : Tool("dragonfly::Link", TC) {}
+    Link(const ToolChain &TC) : Tool("dragonfly::Link", "linker", TC) {}
 
     virtual bool acceptsPipedInput() const { return true; }
     virtual bool canPipeOutput() const { return true; }





More information about the cfe-commits mailing list