From 15a63ed26e9ce1b5d9ff2302492d5b00dbfdab3c Mon Sep 17 00:00:00 2001 From: Douglas Katzman Date: Wed, 12 Aug 2015 18:36:12 +0000 Subject: [PATCH] Don't compare getArchName() to "tce" as a string. NFC. llvm-svn: 244791 --- clang/lib/Driver/Driver.cpp | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 548baf3..fa7780f 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -325,7 +325,8 @@ static llvm::Triple computeTargetTriple(StringRef DefaultTargetTriple, } // Skip further flag support on OSes which don't support '-m32' or '-m64'. - if (Target.getArchName() == "tce" || Target.getOS() == llvm::Triple::Minix) + if (Target.getArch() == llvm::Triple::tce || + Target.getOS() == llvm::Triple::Minix) return Target; // Handle pseudo-target flags '-m64', '-mx32', '-m32' and '-m16'. @@ -2232,21 +2233,27 @@ const ToolChain &Driver::getToolChain(const ArgList &Args, default: // Of these targets, Hexagon is the only one that might have // an OS of Linux, in which case it got handled above already. - if (Target.getArchName() == "tce") + switch (Target.getArch()) { + case llvm::Triple::tce: TC = new toolchains::TCEToolChain(*this, Target, Args); - else if (Target.getArch() == llvm::Triple::hexagon) + break; + case llvm::Triple::hexagon: TC = new toolchains::HexagonToolChain(*this, Target, Args); - else if (Target.getArch() == llvm::Triple::xcore) + break; + case llvm::Triple::xcore: TC = new toolchains::XCoreToolChain(*this, Target, Args); - else if (Target.getArch() == llvm::Triple::shave) + break; + case llvm::Triple::shave: TC = new toolchains::SHAVEToolChain(*this, Target, Args); - else if (Target.isOSBinFormatELF()) - TC = new toolchains::Generic_ELF(*this, Target, Args); - else if (Target.isOSBinFormatMachO()) - TC = new toolchains::MachO(*this, Target, Args); - else - TC = new toolchains::Generic_GCC(*this, Target, Args); - break; + break; + default: + if (Target.isOSBinFormatELF()) + TC = new toolchains::Generic_ELF(*this, Target, Args); + else if (Target.isOSBinFormatMachO()) + TC = new toolchains::MachO(*this, Target, Args); + else + TC = new toolchains::Generic_GCC(*this, Target, Args); + } } } return *TC; -- 2.7.4