[cfe-commits] r148797 - in /cfe/trunk: include/clang/Driver/HostInfo.h lib/Driver/Driver.cpp lib/Driver/HostInfo.cpp

Chandler Carruth chandlerc at gmail.com
Tue Jan 24 02:43:45 PST 2012


Author: chandlerc
Date: Tue Jan 24 04:43:44 2012
New Revision: 148797

URL: http://llvm.org/viewvc/llvm-project?rev=148797&view=rev
Log:
Remove HostInfo::useDriverDriver(). This was only used in two places
inside the innards of the Driver implementation, and only ever
implemented to return 'true' for the Darwin OSes. Instead use a more
direct query on the target triple and a comment to document why the
target matters here.

If anyone is worried about this predicate getting wider use or improper
use, I can make it a local or private predicate in the driver.

Modified:
    cfe/trunk/include/clang/Driver/HostInfo.h
    cfe/trunk/lib/Driver/Driver.cpp
    cfe/trunk/lib/Driver/HostInfo.cpp

Modified: cfe/trunk/include/clang/Driver/HostInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/HostInfo.h?rev=148797&r1=148796&r2=148797&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/HostInfo.h (original)
+++ cfe/trunk/include/clang/Driver/HostInfo.h Tue Jan 24 04:43:44 2012
@@ -43,10 +43,6 @@
   std::string getPlatformName() const { return Triple.getVendorName(); }
   std::string getOSName() const { return Triple.getOSName(); }
 
-  /// useDriverDriver - Whether the driver should act as a driver driver for
-  /// this host and support -arch, -Xarch, etc.
-  virtual bool useDriverDriver() const = 0;
-
   /// CreateToolChain - Construct the toolchain to use for this host (which the
   /// host retains ownership of).
   ///

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=148797&r1=148796&r2=148797&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Tue Jan 24 04:43:44 2012
@@ -348,8 +348,9 @@
   InputList Inputs;
   BuildInputs(C->getDefaultToolChain(), C->getArgs(), Inputs);
 
-  // Construct the list of abstract actions to perform for this compilation.
-  if (Host->useDriverDriver())
+  // Construct the list of abstract actions to perform for this compilation. On
+  // Darwin target OSes this uses the driver-driver and universal actions.
+  if (TargetTriple.isOSDarwin())
     BuildUniversalActions(C->getDefaultToolChain(), C->getArgs(),
                           Inputs, C->getActions());
   else
@@ -437,8 +438,9 @@
     return;
   }
 
-  // Construct the list of abstract actions to perform for this compilation.
-  if (Host->useDriverDriver())
+  // Construct the list of abstract actions to perform for this compilation. On
+  // Darwin OSes this uses the driver-driver and builds universal actions.
+  if (TargetTriple.isOSDarwin())
     BuildUniversalActions(C.getDefaultToolChain(), C.getArgs(),
                           Inputs, C.getActions());
   else

Modified: cfe/trunk/lib/Driver/HostInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/HostInfo.cpp?rev=148797&r1=148796&r2=148797&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/HostInfo.cpp (original)
+++ cfe/trunk/lib/Driver/HostInfo.cpp Tue Jan 24 04:43:44 2012
@@ -45,8 +45,6 @@
   DarwinHostInfo(const Driver &D, const llvm::Triple &Triple);
   ~DarwinHostInfo();
 
-  virtual bool useDriverDriver() const;
-
   virtual ToolChain *CreateToolChain(const ArgList &Args,
                                      const char *ArchName) const;
 };
@@ -61,10 +59,6 @@
     delete it->second;
 }
 
-bool DarwinHostInfo::useDriverDriver() const {
-  return true;
-}
-
 ToolChain *DarwinHostInfo::CreateToolChain(const ArgList &Args,
                                            const char *ArchName) const {
   llvm::Triple::ArchType Arch;
@@ -132,8 +126,6 @@
   TCEHostInfo(const Driver &D, const llvm::Triple &Triple);
   ~TCEHostInfo() {}
 
-  virtual bool useDriverDriver() const;
-
   virtual ToolChain *CreateToolChain(const ArgList &Args, 
                                      const char *ArchName) const;
 };
@@ -142,10 +134,6 @@
   : HostInfo(D, Triple) {
 }
 
-bool TCEHostInfo::useDriverDriver() const { 
-  return false;
-}
-
 ToolChain *TCEHostInfo::CreateToolChain(const ArgList &Args, 
                                         const char *ArchName) const {
   llvm::Triple TCTriple(getTriple());
@@ -165,8 +153,6 @@
   UnknownHostInfo(const Driver &D, const llvm::Triple& Triple);
   ~UnknownHostInfo();
 
-  virtual bool useDriverDriver() const;
-
   virtual ToolChain *CreateToolChain(const ArgList &Args,
                                      const char *ArchName) const;
 };
@@ -181,10 +167,6 @@
     delete it->second;
 }
 
-bool UnknownHostInfo::useDriverDriver() const {
-  return false;
-}
-
 ToolChain *UnknownHostInfo::CreateToolChain(const ArgList &Args,
                                             const char *ArchName) const {
   assert(!ArchName &&
@@ -228,8 +210,6 @@
     : HostInfo(D, Triple) {}
   ~OpenBSDHostInfo();
 
-  virtual bool useDriverDriver() const;
-
   virtual ToolChain *CreateToolChain(const ArgList &Args,
                                      const char *ArchName) const;
 };
@@ -240,10 +220,6 @@
     delete it->second;
 }
 
-bool OpenBSDHostInfo::useDriverDriver() const {
-  return false;
-}
-
 ToolChain *OpenBSDHostInfo::CreateToolChain(const ArgList &Args,
                                             const char *ArchName) const {
   assert(!ArchName &&
@@ -275,8 +251,6 @@
     : HostInfo(D, Triple) {}
   ~AuroraUXHostInfo();
 
-  virtual bool useDriverDriver() const;
-
   virtual ToolChain *CreateToolChain(const ArgList &Args,
                                      const char *ArchName) const;
 };
@@ -287,10 +261,6 @@
     delete it->second;
 }
 
-bool AuroraUXHostInfo::useDriverDriver() const {
-  return false;
-}
-
 ToolChain *AuroraUXHostInfo::CreateToolChain(const ArgList &Args,
                                              const char *ArchName) const {
   assert(!ArchName &&
@@ -320,8 +290,6 @@
     : HostInfo(D, Triple) {}
   ~FreeBSDHostInfo();
 
-  virtual bool useDriverDriver() const;
-
   virtual ToolChain *CreateToolChain(const ArgList &Args,
                                      const char *ArchName) const;
 };
@@ -332,10 +300,6 @@
     delete it->second;
 }
 
-bool FreeBSDHostInfo::useDriverDriver() const {
-  return false;
-}
-
 ToolChain *FreeBSDHostInfo::CreateToolChain(const ArgList &Args,
                                             const char *ArchName) const {
   assert(!ArchName &&
@@ -379,8 +343,6 @@
     : HostInfo(D, Triple) {}
   ~NetBSDHostInfo();
 
-  virtual bool useDriverDriver() const;
-
   virtual ToolChain *CreateToolChain(const ArgList &Args,
                                      const char *ArchName) const;
 };
@@ -391,10 +353,6 @@
     delete it->second;
 }
 
-bool NetBSDHostInfo::useDriverDriver() const {
-  return false;
-}
-
 ToolChain *NetBSDHostInfo::CreateToolChain(const ArgList &Args,
                                             const char *ArchName) const {
   assert(!ArchName &&
@@ -443,8 +401,6 @@
     : HostInfo(D, Triple) {}
   ~MinixHostInfo();
 
-  virtual bool useDriverDriver() const;
-
   virtual ToolChain *CreateToolChain(const ArgList &Args,
                                      const char *ArchName) const;
 };
@@ -456,10 +412,6 @@
   }
 }
 
-bool MinixHostInfo::useDriverDriver() const {
-  return false;
-}
-
 ToolChain *MinixHostInfo::CreateToolChain(const ArgList &Args,
                                             const char *ArchName) const {
   assert(!ArchName &&
@@ -491,8 +443,6 @@
     : HostInfo(D, Triple) {}
   ~DragonFlyHostInfo();
 
-  virtual bool useDriverDriver() const;
-
   virtual ToolChain *CreateToolChain(const ArgList &Args,
                                      const char *ArchName) const;
 };
@@ -503,10 +453,6 @@
     delete it->second;
 }
 
-bool DragonFlyHostInfo::useDriverDriver() const {
-  return false;
-}
-
 ToolChain *DragonFlyHostInfo::CreateToolChain(const ArgList &Args,
                                               const char *ArchName) const {
   assert(!ArchName &&
@@ -536,8 +482,6 @@
     : HostInfo(D, Triple) {}
   ~LinuxHostInfo();
 
-  virtual bool useDriverDriver() const;
-
   virtual ToolChain *CreateToolChain(const ArgList &Args,
                                      const char *ArchName) const;
 };
@@ -548,10 +492,6 @@
     delete it->second;
 }
 
-bool LinuxHostInfo::useDriverDriver() const {
-  return false;
-}
-
 ToolChain *LinuxHostInfo::CreateToolChain(const ArgList &Args,
                                           const char *ArchName) const {
 
@@ -601,8 +541,6 @@
   WindowsHostInfo(const Driver &D, const llvm::Triple& Triple);
   ~WindowsHostInfo();
 
-  virtual bool useDriverDriver() const;
-
   virtual types::ID lookupTypeForExtension(const char *Ext) const {
     return types::lookupTypeForExtension(Ext);
   }
@@ -621,10 +559,6 @@
     delete it->second;
 }
 
-bool WindowsHostInfo::useDriverDriver() const {
-  return false;
-}
-
 ToolChain *WindowsHostInfo::CreateToolChain(const ArgList &Args,
                                             const char *ArchName) const {
   assert(!ArchName &&





More information about the cfe-commits mailing list