diff options
author | Anders Carlsson <andersca@mac.com> | 2011-02-28 00:44:51 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2011-02-28 00:44:51 +0000 |
commit | 525544de0835d5ee7497f4897e255727b162e0aa (patch) | |
tree | db0497d197c28c1c503aa31a1f34f192148d6f6a /lib/Driver/Tools.cpp | |
parent | 2bef7f5499541e3b68f114cc4d7d197e9a902fe7 (diff) |
Factor code out into a helper function, shouldUseExceptionTablesForObjCExceptions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126601 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Tools.cpp')
-rw-r--r-- | lib/Driver/Tools.cpp | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 9f4a0bc162..ef869f1ecf 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -762,6 +762,24 @@ void Clang::AddX86TargetArgs(const ArgList &Args, } } +static bool +shouldUseExceptionTablesForObjCExceptions(const ArgList &Args, + const llvm::Triple &Triple) { + // We use the zero-cost exception tables for Objective-C if the non-fragile + // ABI is enabled or when compiling for x86_64 and ARM on Snow Leopard and + // later. + + if (Args.hasArg(options::OPT_fobjc_nonfragile_abi)) + return true; + + if (Triple.getOS() != llvm::Triple::Darwin) + return false; + + return (Triple.getDarwinMajorNumber() >= 9 && + (Triple.getArch() == llvm::Triple::x86_64 || + Triple.getArch() == llvm::Triple::arm)); +} + static bool needsExceptions(const ArgList &Args, types::ID InputType, const llvm::Triple &Triple) { // Handle -fno-exceptions. @@ -777,17 +795,8 @@ static bool needsExceptions(const ArgList &Args, types::ID InputType, if (types::isCXX(InputType)) return true; - // As do Objective-C non-fragile ABI inputs and all Objective-C inputs on - // x86_64 and ARM after SnowLeopard. - if (types::isObjC(InputType)) { - if (Args.hasArg(options::OPT_fobjc_nonfragile_abi)) - return true; - if (Triple.getOS() != llvm::Triple::Darwin) - return false; - return (Triple.getDarwinMajorNumber() >= 9 && - (Triple.getArch() == llvm::Triple::x86_64 || - Triple.getArch() == llvm::Triple::arm)); - } + if (types::isObjC(InputType)) + return shouldUseExceptionTablesForObjCExceptions(Args, Triple); return false; } |