summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/Tools.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2011-03-17 23:28:31 +0000
committerDaniel Dunbar <daniel@zuster.org>2011-03-17 23:28:31 +0000
commitc44f8cf7b8b832d6d586a8ed128b569315fb7854 (patch)
treebd69961fef4f5cfd6d0f3d01460277770d546815 /clang/lib/Driver/Tools.cpp
parentab959a2e68a0c40abb9f69adefb33e1306022333 (diff)
downloadbcm5719-llvm-c44f8cf7b8b832d6d586a8ed128b569315fb7854.tar.gz
bcm5719-llvm-c44f8cf7b8b832d6d586a8ed128b569315fb7854.zip
Driver/Obj-C: Be compatible with GCC behavior in that -fno-exceptions *does not*
disable Obj-C exceptions. llvm-svn: 127836
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r--clang/lib/Driver/Tools.cpp29
1 files changed, 10 insertions, 19 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index cf6a8539527..45fdd8be2e6 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -843,25 +843,16 @@ static void addExceptionArgs(const ArgList &Args, types::ID InputType,
if (ExceptionsEnabled && DidHaveExplicitExceptionFlag)
ShouldUseExceptionTables = true;
- if (types::isObjC(InputType)) {
- bool ObjCExceptionsEnabled = ExceptionsEnabled;
-
- if (Arg *A = Args.getLastArg(options::OPT_fobjc_exceptions,
- options::OPT_fno_objc_exceptions,
- options::OPT_fexceptions,
- options::OPT_fno_exceptions)) {
- if (A->getOption().matches(options::OPT_fobjc_exceptions))
- ObjCExceptionsEnabled = true;
- else if (A->getOption().matches(options::OPT_fno_objc_exceptions))
- ObjCExceptionsEnabled = false;
- }
-
- if (ObjCExceptionsEnabled) {
- CmdArgs.push_back("-fobjc-exceptions");
-
- ShouldUseExceptionTables |=
- shouldUseExceptionTablesForObjCExceptions(Args, Triple);
- }
+ // Obj-C exceptions are enabled by default, regardless of -fexceptions. This
+ // is not necessarily sensible, but follows GCC.
+ if (types::isObjC(InputType) &&
+ Args.hasFlag(options::OPT_fobjc_exceptions,
+ options::OPT_fno_objc_exceptions,
+ true)) {
+ CmdArgs.push_back("-fobjc-exceptions");
+
+ ShouldUseExceptionTables |=
+ shouldUseExceptionTablesForObjCExceptions(Args, Triple);
}
if (types::isCXX(InputType)) {
OpenPOWER on IntegriCloud