diff options
author | John McCall <rjmccall@apple.com> | 2015-10-30 00:56:02 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2015-10-30 00:56:02 +0000 |
commit | 17f0275d4c2ea19b5a2376e3b008c41f18358d31 (patch) | |
tree | 8fce310dd5d44695ce96303733ec6541d2bbcfdc /clang/test/CodeGenObjC/fragile-arc.m | |
parent | ca64d675f1201d022ee65e86aec3359b8b1778be (diff) | |
download | bcm5719-llvm-17f0275d4c2ea19b5a2376e3b008c41f18358d31.tar.gz bcm5719-llvm-17f0275d4c2ea19b5a2376e3b008c41f18358d31.zip |
Initialize @catch variables correctly in fragile-runtime ARC.
llvm-svn: 251677
Diffstat (limited to 'clang/test/CodeGenObjC/fragile-arc.m')
-rw-r--r-- | clang/test/CodeGenObjC/fragile-arc.m | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/clang/test/CodeGenObjC/fragile-arc.m b/clang/test/CodeGenObjC/fragile-arc.m index c3a4c088d02..ecb955bd34a 100644 --- a/clang/test/CodeGenObjC/fragile-arc.m +++ b/clang/test/CodeGenObjC/fragile-arc.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime=macosx-fragile-10.10 -o - %s | FileCheck %s -// RUN: %clang_cc1 -triple i386-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime=macosx-fragile-10.10 -o - %s | FileCheck %s -check-prefix=GLOBALS +// RUN: %clang_cc1 -triple i386-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -fobjc-exceptions -fobjc-runtime=macosx-fragile-10.10 -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple i386-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -fobjc-exceptions -fobjc-runtime=macosx-fragile-10.10 -o - %s | FileCheck %s -check-prefix=GLOBALS @class Opaque; @@ -136,3 +136,40 @@ void testBlockLayoutStrong(id x) { void testBlockLayoutWeak(__weak id x) { useBlock(^{ (void) x; }); } + +// CHECK-LABEL: define void @testCatch() +// CHECK: [[X:%.*]] = alloca [[A:%.*]]*, align 4 +// CHECK: [[Y:%.*]] = alloca i8*, align 4 +// CHECK: call void @objc_exception_try_enter +// CHECK: br i1 +// CHECK: call void @checkpoint(i32 0) +// CHECK: call void @objc_exception_try_exit +// CHECK: br label +// CHECK: call void @checkpoint(i32 3) +// CHECK: [[EXN:%.*]] = call i8* @objc_exception_extract +// CHECK: call i32 @objc_exception_match( +// CHECK: br i1 +// CHECK: [[T0:%.*]] = bitcast i8* [[EXN]] to [[A]]* +// CHECK: [[T1:%.*]] = bitcast [[A]]* [[T0]] to i8* +// CHECK: [[T2:%.*]] = call i8* @objc_retain(i8* [[T1]]) +// CHECK: [[T3:%.*]] = bitcast i8* [[T2]] to [[A]]* +// CHECK: store [[A]]* [[T3]], [[A]]** [[X]] +// CHECK: call void @checkpoint(i32 1) +// CHECK: [[T0:%.*]] = bitcast [[A]]** [[X]] to i8** +// CHECK: call void @objc_storeStrong(i8** [[T0]], i8* null) +// CHECK: br label +// CHECK: [[T0:%.*]] = call i8* @objc_retain(i8* [[EXN]]) +// CHECK: store i8* [[T0]], i8** [[Y]] +// CHECK: call void @checkpoint(i32 2) +// CHECK: call void @objc_storeStrong(i8** [[Y]], i8* null) +extern void checkpoint(int n); +void testCatch() { + @try { + checkpoint(0); + } @catch (A *x) { + checkpoint(1); + } @catch (id y) { + checkpoint(2); + } + checkpoint(3); +} |