aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGenObjC/exceptions.m
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-07-06 01:34:17 +0000
committerJohn McCall <rjmccall@apple.com>2010-07-06 01:34:17 +0000
commitf1549f66a8216a78112286e3978cea2c29d6334c (patch)
treeabcabedb8b72594ef7ea106fc08684927d3a386b /test/CodeGenObjC/exceptions.m
parent6c47a9b9779216ef24526c064d5b6ab0db0b5009 (diff)
Validated by nightly-test runs on x86 and x86-64 darwin, including after
self-host. Hopefully these results hold up on different platforms. I tried to keep the GNU ObjC runtime happy, but it's hard for me to test. Reimplement how clang generates IR for exceptions. Instead of creating new invoke destinations which sequentially chain to the previous destination, push a more semantic representation of *why* we need the cleanup/catch/filter behavior, then collect that information into a single landing pad upon request. Also reorganizes how normal cleanups (i.e. cleanups triggered by non-exceptional control flow) are generated, since it's actually fairly closely tied in with the former. Remove the need to track which cleanup scope a block is associated with. Document a lot of previously poorly-understood (by me, at least) behavior. The new framework implements the Horrible Hack (tm), which requires every landing pad to have a catch-all so that inlining will work. Clang no longer requires the Horrible Hack just to make exceptions flow correctly within a function, however. The HH is an unfortunate requirement of LLVM's EH IR. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107631 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenObjC/exceptions.m')
-rw-r--r--test/CodeGenObjC/exceptions.m29
1 files changed, 25 insertions, 4 deletions
diff --git a/test/CodeGenObjC/exceptions.m b/test/CodeGenObjC/exceptions.m
index a74dee95dd..5be695932b 100644
--- a/test/CodeGenObjC/exceptions.m
+++ b/test/CodeGenObjC/exceptions.m
@@ -1,11 +1,8 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -O2 -o - %s | FileCheck %s
//
// <rdar://problem/7471679> [irgen] [eh] Exception code built with clang (x86_64) crashes
// Just check that we don't emit any dead blocks.
-//
-// RUN: grep 'No predecessors' %t | count 0
-
@interface NSArray @end
void f0() {
@try {
@@ -16,3 +13,27 @@ void f0() {
} @catch (id e) {
}
}
+
+// CHECK: define void @f1()
+void f1() {
+ extern void foo(void);
+
+ while (1) {
+ // CHECK: call void @objc_exception_try_enter
+ // CHECK-NEXT: getelementptr
+ // CHECK-NEXT: call i32 @_setjmp(
+ // CHECK-NEXT: icmp
+ // CHECK-NEXT: br i1
+ @try {
+ // CHECK: call void @foo()
+ foo();
+ // CHECK: call void @objc_exception_try_exit
+ // CHECK-NEXT: ret void
+
+ // CHECK: call i8* @objc_exception_extract
+ // CHECK-NEXT: ret void
+ } @finally {
+ break;
+ }
+ }
+}