aboutsummaryrefslogtreecommitdiff
path: root/include/clang
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-07-06 01:22:26 +0000
committerJohn McCall <rjmccall@apple.com>2011-07-06 01:22:26 +0000
commit256a76e0b0e0c9e65a3122917d553ef10bc84d29 (patch)
treeeed80264ac453d3e22cd9e9d1b364c41e1a12c5a /include/clang
parentc06e0743431b28c96e0bbe27cc07851d2e0d2681 (diff)
Call objc_terminate() instead of abort() when a cleanup throws an
exception in Objective-C; in Objective-C++ we still use std::terminate(). This is only available in very recent runtimes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134456 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang')
-rw-r--r--include/clang/Driver/CC1Options.td2
-rw-r--r--include/clang/Driver/ObjCRuntime.h9
-rw-r--r--include/clang/Frontend/CodeGenOptions.h5
3 files changed, 14 insertions, 2 deletions
diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td
index aab0213b95..6f38ea5199 100644
--- a/include/clang/Driver/CC1Options.td
+++ b/include/clang/Driver/CC1Options.td
@@ -500,6 +500,8 @@ def fobjc_runtime_has_arc : Flag<"-fobjc-runtime-has-arc">,
HelpText<"The target Objective-C runtime provides ARC entrypoints">;
def fobjc_runtime_has_weak : Flag<"-fobjc-runtime-has-weak">,
HelpText<"The target Objective-C runtime supports ARC weak operations">;
+def fobjc_runtime_has_terminate : Flag<"-fobjc-runtime-has-terminate">,
+ HelpText<"The target Objective-C runtime provides an objc_terminate entrypoint">;
def fobjc_gc : Flag<"-fobjc-gc">,
HelpText<"Enable Objective-C garbage collection">;
def fobjc_gc_only : Flag<"-fobjc-gc-only">,
diff --git a/include/clang/Driver/ObjCRuntime.h b/include/clang/Driver/ObjCRuntime.h
index 241354f15e..5516460433 100644
--- a/include/clang/Driver/ObjCRuntime.h
+++ b/include/clang/Driver/ObjCRuntime.h
@@ -30,7 +30,14 @@ public:
/// True if the runtime supports ARC zeroing __weak.
unsigned HasWeak : 1;
- ObjCRuntime() : RuntimeKind(NeXT), HasARC(false), HasWeak(false) {}
+ /// True if the runtime provides the following entrypoint:
+ /// void objc_terminate(void);
+ /// If available, this will be called instead of abort() when an
+ /// exception is thrown out of an EH cleanup.
+ unsigned HasTerminate : 1;
+
+ ObjCRuntime() : RuntimeKind(NeXT), HasARC(false), HasWeak(false),
+ HasTerminate(false) {}
};
}
diff --git a/include/clang/Frontend/CodeGenOptions.h b/include/clang/Frontend/CodeGenOptions.h
index d415d0a889..5d040b4f26 100644
--- a/include/clang/Frontend/CodeGenOptions.h
+++ b/include/clang/Frontend/CodeGenOptions.h
@@ -77,6 +77,7 @@ public:
unsigned NoZeroInitializedInBSS : 1; /// -fno-zero-initialized-in-bss
unsigned ObjCDispatchMethod : 2; /// Method of Objective-C dispatch to use.
unsigned ObjCRuntimeHasARC : 1; /// The target runtime supports ARC natively
+ unsigned ObjCRuntimeHasTerminate : 1; /// The ObjC runtime has objc_terminate
unsigned OmitLeafFramePointer : 1; /// Set when -momit-leaf-frame-pointer is
/// enabled.
unsigned OptimizationLevel : 3; /// The -O[0-4] option specified.
@@ -141,7 +142,6 @@ public:
public:
CodeGenOptions() {
AsmVerbose = 0;
- ObjCAutoRefCountExceptions = 0;
CXAAtExit = 1;
CXXCtorDtorAliases = 0;
DataSections = 0;
@@ -168,7 +168,10 @@ public:
NoNaNsFPMath = 0;
NoZeroInitializedInBSS = 0;
NumRegisterParameters = 0;
+ ObjCAutoRefCountExceptions = 0;
ObjCDispatchMethod = Legacy;
+ ObjCRuntimeHasARC = 0;
+ ObjCRuntimeHasTerminate = 0;
OmitLeafFramePointer = 0;
OptimizationLevel = 0;
OptimizeSize = 0;