Revert "Driver: Objective-C should respect -fno-exceptions"

This reverts commit r223455.  It's been succesfully argued that
-fexceptions (at the driver level) is a misnomer and has little to do
with -fobjc-exceptions.

llvm-svn: 223723
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index 9924bb8..151d87b 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -1894,6 +1894,23 @@
   }
 }
 
+static bool
+shouldUseExceptionTablesForObjCExceptions(const ObjCRuntime &runtime,
+                                          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 (runtime.isNonFragile())
+    return true;
+
+  if (!Triple.isMacOSX())
+    return false;
+
+  return (!Triple.isMacOSXVersionLT(10,5) &&
+          (Triple.getArch() == llvm::Triple::x86_64 ||
+           Triple.getArch() == llvm::Triple::arm));
+}
+
 // exceptionSettings() exists to share the logic between -cc1 and linker
 // invocations.
 static bool exceptionSettings(const ArgList &Args, const llvm::Triple &Triple) {
@@ -1930,21 +1947,15 @@
   // Gather the exception settings from the command line arguments.
   bool EH = exceptionSettings(Args, Triple);
 
-  if (types::isObjC(InputType)) {
-    bool ObjCExceptionsEnabled = true;
-    if (Arg *A = Args.getLastArg(options::OPT_fobjc_exceptions,
-                                 options::OPT_fno_objc_exceptions,
-                                 options::OPT_fexceptions,
-                                 options::OPT_fno_exceptions))
-      ObjCExceptionsEnabled =
-          A->getOption().matches(options::OPT_fobjc_exceptions) ||
-          A->getOption().matches(options::OPT_fexceptions);
+  // 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");
 
-    if (ObjCExceptionsEnabled) {
-      CmdArgs.push_back("-fobjc-exceptions");
-
-      EH = true;
-    }
+    EH |= shouldUseExceptionTablesForObjCExceptions(objcRuntime, Triple);
   }
 
   if (types::isCXX(InputType)) {