From f0a5b9b126b9d00b59f269fb6909c71046f52399 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Fri, 4 Sep 2009 18:34:51 +0000 Subject: [PATCH] Rename Darwin_X86 toolchain to just Darwin, this can support all platforms. llvm-svn: 81016 --- clang/lib/Driver/HostInfo.cpp | 6 +++--- clang/lib/Driver/ToolChains.cpp | 25 ++++++++++++------------- clang/lib/Driver/ToolChains.h | 8 ++++---- clang/lib/Driver/Tools.cpp | 4 ---- clang/lib/Driver/Tools.h | 6 ++++-- 5 files changed, 23 insertions(+), 26 deletions(-) diff --git a/clang/lib/Driver/HostInfo.cpp b/clang/lib/Driver/HostInfo.cpp index 1b64212d8877..89a3f8f49efb 100644 --- a/clang/lib/Driver/HostInfo.cpp +++ b/clang/lib/Driver/HostInfo.cpp @@ -157,9 +157,9 @@ ToolChain *DarwinHostInfo::getToolChain(const ArgList &Args, TCTriple.setArchName(ArchName); if (strcmp(ArchName, "i386") == 0 || strcmp(ArchName, "x86_64") == 0) - TC = new toolchains::Darwin_X86(*this, TCTriple, - DarwinVersion, - GCCVersion); + TC = new toolchains::Darwin(*this, TCTriple, + DarwinVersion, + GCCVersion); else TC = new toolchains::Darwin_GCC(*this, TCTriple); } diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp index e9b59f5fad98..63b629f9ec2f 100644 --- a/clang/lib/Driver/ToolChains.cpp +++ b/clang/lib/Driver/ToolChains.cpp @@ -25,11 +25,11 @@ using namespace clang::driver; using namespace clang::driver::toolchains; -/// Darwin_X86 - Darwin tool chain for i386 and x86_64. +/// Darwin - Darwin tool chain for i386 and x86_64. -Darwin_X86::Darwin_X86(const HostInfo &Host, const llvm::Triple& Triple, - const unsigned (&_DarwinVersion)[3], - const unsigned (&_GCCVersion)[3]) +Darwin::Darwin(const HostInfo &Host, const llvm::Triple& Triple, + const unsigned (&_DarwinVersion)[3], + const unsigned (&_GCCVersion)[3]) : ToolChain(Host, Triple) { DarwinVersion[0] = _DarwinVersion[0]; DarwinVersion[1] = _DarwinVersion[1]; @@ -89,15 +89,14 @@ Darwin_X86::Darwin_X86(const HostInfo &Host, const llvm::Triple& Triple, getProgramPaths().push_back(getHost().getDriver().Dir); } -Darwin_X86::~Darwin_X86() { +Darwin::~Darwin() { // Free tool implementations. for (llvm::DenseMap::iterator it = Tools.begin(), ie = Tools.end(); it != ie; ++it) delete it->second; } -Tool &Darwin_X86::SelectTool(const Compilation &C, - const JobAction &JA) const { +Tool &Darwin::SelectTool(const Compilation &C, const JobAction &JA) const { Action::ActionClass Key; if (getHost().getDriver().ShouldUseClangCompiler(C, JA, getArchName())) Key = Action::AnalyzeJobClass; @@ -129,7 +128,7 @@ Tool &Darwin_X86::SelectTool(const Compilation &C, return *T; } -DerivedArgList *Darwin_X86::TranslateArgs(InputArgList &Args) const { +DerivedArgList *Darwin::TranslateArgs(InputArgList &Args) const { DerivedArgList *DAL = new DerivedArgList(Args, false); const OptTable &Opts = getHost().getDriver().getOpts(); @@ -284,21 +283,21 @@ DerivedArgList *Darwin_X86::TranslateArgs(InputArgList &Args) const { return DAL; } -bool Darwin_X86::IsMathErrnoDefault() const { +bool Darwin::IsMathErrnoDefault() const { return false; } -bool Darwin_X86::IsUnwindTablesDefault() const { +bool Darwin::IsUnwindTablesDefault() const { // FIXME: Gross; we should probably have some separate target // definition, possibly even reusing the one in clang. return getArchName() == "x86_64"; } -const char *Darwin_X86::GetDefaultRelocationModel() const { +const char *Darwin::GetDefaultRelocationModel() const { return "pic"; } -const char *Darwin_X86::GetForcedPicModel() const { +const char *Darwin::GetForcedPicModel() const { if (getArchName() == "x86_64") return "pic"; return 0; @@ -362,7 +361,7 @@ Tool &Generic_GCC::SelectTool(const Compilation &C, return *T; } -bool Generic_GCC::IsMathErrnoDefault() const { +bool Generic_GCC::IsMathErrnoDefault() const { return true; } diff --git a/clang/lib/Driver/ToolChains.h b/clang/lib/Driver/ToolChains.h index 28bedbb03563..3d8632eb96d0 100644 --- a/clang/lib/Driver/ToolChains.h +++ b/clang/lib/Driver/ToolChains.h @@ -43,8 +43,8 @@ public: virtual const char *GetForcedPicModel() const; }; - /// Darwin_X86 - Darwin tool chain for i386 an x86_64. -class VISIBILITY_HIDDEN Darwin_X86 : public ToolChain { +/// Darwin - Darwin tool chain. +class VISIBILITY_HIDDEN Darwin : public ToolChain { mutable llvm::DenseMap Tools; /// Darwin version of tool chain. @@ -63,10 +63,10 @@ class VISIBILITY_HIDDEN Darwin_X86 : public ToolChain { const char *getMacosxVersionMin() const; public: - Darwin_X86(const HostInfo &Host, const llvm::Triple& Triple, + Darwin(const HostInfo &Host, const llvm::Triple& Triple, const unsigned (&DarwinVersion)[3], const unsigned (&GCCVersion)[3]); - ~Darwin_X86(); + ~Darwin(); void getDarwinVersion(unsigned (&Res)[3]) const { Res[0] = DarwinVersion[0]; diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index b7357ec13a40..b72d562dce9d 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -1368,10 +1368,6 @@ static bool isMacosxVersionLT(unsigned (&A)[3], return isMacosxVersionLT(A, B); } -const toolchains::Darwin_X86 &darwin::Link::getDarwinToolChain() const { - return reinterpret_cast(getToolChain()); -} - void darwin::Link::AddDarwinArch(const ArgList &Args, ArgStringList &CmdArgs) const { // Derived from darwin_arch spec. diff --git a/clang/lib/Driver/Tools.h b/clang/lib/Driver/Tools.h index 67e25f63cf01..4821c548b1e1 100644 --- a/clang/lib/Driver/Tools.h +++ b/clang/lib/Driver/Tools.h @@ -21,7 +21,7 @@ namespace driver { class Driver; namespace toolchains { - class Darwin_X86; + class Darwin; } namespace tools { @@ -201,7 +201,9 @@ namespace darwin { void AddDarwinSubArch(const ArgList &Args, ArgStringList &CmdArgs) const; void AddLinkArgs(const ArgList &Args, ArgStringList &CmdArgs) const; - const toolchains::Darwin_X86 &getDarwinToolChain() const; + const toolchains::Darwin &getDarwinToolChain() const { + return reinterpret_cast(getToolChain()); + } public: Link(const ToolChain &TC)