From 4a04d0b4aa33e98ea9e7b3e787f0490585ce9b6f Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Tue, 24 Jan 2012 10:43:44 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148797 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Driver/HostInfo.h | 4 -- lib/Driver/Driver.cpp | 10 +++-- lib/Driver/HostInfo.cpp | 66 --------------------------------- 3 files changed, 6 insertions(+), 74 deletions(-) diff --git a/include/clang/Driver/HostInfo.h b/include/clang/Driver/HostInfo.h index 7285a48b1c..7a85202470 100644 --- a/include/clang/Driver/HostInfo.h +++ b/include/clang/Driver/HostInfo.h @@ -43,10 +43,6 @@ public: 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). /// diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index 1edea61360..c5007b820f 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -348,8 +348,9 @@ Compilation *Driver::BuildCompilation(ArrayRef ArgList) { 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 @@ void Driver::generateCompilationDiagnostics(Compilation &C, 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 diff --git a/lib/Driver/HostInfo.cpp b/lib/Driver/HostInfo.cpp index 0e7879278a..4010311823 100644 --- a/lib/Driver/HostInfo.cpp +++ b/lib/Driver/HostInfo.cpp @@ -45,8 +45,6 @@ public: 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 @@ DarwinHostInfo::~DarwinHostInfo() { 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 @@ public: 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 @@ TCEHostInfo::TCEHostInfo(const Driver &D, const llvm::Triple& Triple) : 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 @@ public: 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 @@ UnknownHostInfo::~UnknownHostInfo() { 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 @@ public: : HostInfo(D, Triple) {} ~OpenBSDHostInfo(); - virtual bool useDriverDriver() const; - virtual ToolChain *CreateToolChain(const ArgList &Args, const char *ArchName) const; }; @@ -240,10 +220,6 @@ OpenBSDHostInfo::~OpenBSDHostInfo() { 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 @@ public: : HostInfo(D, Triple) {} ~AuroraUXHostInfo(); - virtual bool useDriverDriver() const; - virtual ToolChain *CreateToolChain(const ArgList &Args, const char *ArchName) const; }; @@ -287,10 +261,6 @@ AuroraUXHostInfo::~AuroraUXHostInfo() { 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 @@ public: : HostInfo(D, Triple) {} ~FreeBSDHostInfo(); - virtual bool useDriverDriver() const; - virtual ToolChain *CreateToolChain(const ArgList &Args, const char *ArchName) const; }; @@ -332,10 +300,6 @@ FreeBSDHostInfo::~FreeBSDHostInfo() { 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 @@ public: : HostInfo(D, Triple) {} ~NetBSDHostInfo(); - virtual bool useDriverDriver() const; - virtual ToolChain *CreateToolChain(const ArgList &Args, const char *ArchName) const; }; @@ -391,10 +353,6 @@ NetBSDHostInfo::~NetBSDHostInfo() { 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 @@ public: : HostInfo(D, Triple) {} ~MinixHostInfo(); - virtual bool useDriverDriver() const; - virtual ToolChain *CreateToolChain(const ArgList &Args, const char *ArchName) const; }; @@ -456,10 +412,6 @@ MinixHostInfo::~MinixHostInfo() { } } -bool MinixHostInfo::useDriverDriver() const { - return false; -} - ToolChain *MinixHostInfo::CreateToolChain(const ArgList &Args, const char *ArchName) const { assert(!ArchName && @@ -491,8 +443,6 @@ public: : HostInfo(D, Triple) {} ~DragonFlyHostInfo(); - virtual bool useDriverDriver() const; - virtual ToolChain *CreateToolChain(const ArgList &Args, const char *ArchName) const; }; @@ -503,10 +453,6 @@ DragonFlyHostInfo::~DragonFlyHostInfo() { 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 @@ public: : HostInfo(D, Triple) {} ~LinuxHostInfo(); - virtual bool useDriverDriver() const; - virtual ToolChain *CreateToolChain(const ArgList &Args, const char *ArchName) const; }; @@ -548,10 +492,6 @@ LinuxHostInfo::~LinuxHostInfo() { delete it->second; } -bool LinuxHostInfo::useDriverDriver() const { - return false; -} - ToolChain *LinuxHostInfo::CreateToolChain(const ArgList &Args, const char *ArchName) const { @@ -601,8 +541,6 @@ public: 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 @@ WindowsHostInfo::~WindowsHostInfo() { delete it->second; } -bool WindowsHostInfo::useDriverDriver() const { - return false; -} - ToolChain *WindowsHostInfo::CreateToolChain(const ArgList &Args, const char *ArchName) const { assert(!ArchName && -- 2.40.0