[cfe-commits] r126601 - /cfe/trunk/lib/Driver/Tools.cpp
Anders Carlsson
andersca at mac.com
Sun Feb 27 16:44:51 PST 2011
Author: andersca
Date: Sun Feb 27 18:44:51 2011
New Revision: 126601
URL: http://llvm.org/viewvc/llvm-project?rev=126601&view=rev
Log:
Factor code out into a helper function, shouldUseExceptionTablesForObjCExceptions.
Modified:
cfe/trunk/lib/Driver/Tools.cpp
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=126601&r1=126600&r2=126601&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Sun Feb 27 18:44:51 2011
@@ -762,6 +762,24 @@
}
}
+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 @@
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;
}
More information about the cfe-commits
mailing list