aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2013-04-16 21:29:40 +0000
committerJohn McCall <rjmccall@apple.com>2013-04-16 21:29:40 +0000
commitb57f6b3d8f84e9241fd978e2739d6a9da0870546 (patch)
tree92da8c2686b07a343141d8d2d77b36f735b1c5db /test
parent35e62d3c93936db0b647a7bf2d13131a4eb2f1fe (diff)
downloadclang-b57f6b3d8f84e9241fd978e2739d6a9da0870546.tar.gz
objc_autoreleasePoolPop() can throw if a -dealloc does.
Model it as throwing so that the exception can be caught. This is generally not expected to have significant code-size impact because the contents of the @autoreleasepool block are very likely to contain a call, very likely at the same cleanup level as the @autoreleasepool itself. rdar://13660038 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179630 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CodeGenObjC/autorelease.m27
1 files changed, 25 insertions, 2 deletions
diff --git a/test/CodeGenObjC/autorelease.m b/test/CodeGenObjC/autorelease.m
index 830929afb2..f89b81a8ac 100644
--- a/test/CodeGenObjC/autorelease.m
+++ b/test/CodeGenObjC/autorelease.m
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-arc -fobjc-runtime=macosx-10.7 -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -emit-llvm -fobjc-runtime=macosx-10.7 -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-arc -fobjc-runtime=macosx-10.7 -fexceptions -fobjc-exceptions -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -emit-llvm -fobjc-runtime=macosx-10.7 -fexceptions -fobjc-exceptions -o - %s | FileCheck %s
// rdar://8881826
// rdar://9412038
@@ -28,3 +28,26 @@
// CHECK: call i8* @objc_autoreleasePoolPush
// CHECK: [[T:%.*]] = load i8** [[A:%.*]]
// CHECK: call void @objc_autoreleasePoolPop
+
+// rdar://13660038
+int tryTo(int (*f)(void)) {
+ @try {
+ @autoreleasepool {
+ return f();
+ }
+ } @catch (...) {
+ return 0;
+ }
+}
+// CHECK: define i32 @tryTo(i32 ()*
+// CHECK: [[RET:%.*]] = alloca i32,
+// CHECK: [[T0:%.*]] = call i8* @objc_autoreleasePoolPush()
+// CHECK-NEXT: [[T1:%.*]] = load i32 ()** {{%.*}},
+// CHECK-NEXT: [[T2:%.*]] = invoke i32 [[T1]]()
+// CHECK: store i32 [[T2]], i32* [[RET]]
+// CHECK: invoke void @objc_autoreleasePoolPop(i8* [[T0]])
+// CHECK: landingpad { i8*, i32 } personality
+// CHECK-NEXT: catch i8* null
+// CHECK: call i8* @objc_begin_catch
+// CHECK-NEXT: store i32 0, i32* [[RET]]
+// CHECK: call void @objc_end_catch()