1 // RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-darwin10 -emit-llvm -fobjc-arc -fexceptions -fobjc-exceptions -fobjc-runtime-has-weak -o - %s | FileCheck %s
5 // These first two tests are all PR11732 / rdar://problem/10667070.
7 void test0_helper(void);
14 // CHECK-LABEL: define{{.*}} void @test0()
15 // CHECK: [[E:%.*]] = alloca [[ETY:%.*]]*, align 8
16 // CHECK-NEXT: invoke void @test0_helper()
17 // CHECK: [[T0:%.*]] = call i8* @objc_begin_catch(
18 // CHECK-NEXT: [[T1:%.*]] = bitcast i8* [[T0]] to [[ETY]]*
19 // CHECK-NEXT: [[T2:%.*]] = bitcast [[ETY]]* [[T1]] to i8*
20 // CHECK-NEXT: [[T3:%.*]] = call i8* @llvm.objc.retain(i8* [[T2]]) [[NUW:#[0-9]+]]
21 // CHECK-NEXT: [[T4:%.*]] = bitcast i8* [[T3]] to [[ETY]]*
22 // CHECK-NEXT: store [[ETY]]* [[T4]], [[ETY]]** [[E]]
23 // CHECK-NEXT: [[T0:%.*]] = bitcast [[ETY]]** [[E]] to i8**
24 // CHECK-NEXT: call void @llvm.objc.storeStrong(i8** [[T0]], i8* null) [[NUW]]
25 // CHECK-NEXT: call void @objc_end_catch() [[NUW]]
27 void test1_helper(void);
31 } @catch (__weak Ety *e) {
34 // CHECK-LABEL: define{{.*}} void @test1()
35 // CHECK: [[E:%.*]] = alloca [[ETY:%.*]]*, align 8
36 // CHECK-NEXT: invoke void @test1_helper()
37 // CHECK: [[T0:%.*]] = call i8* @objc_begin_catch(
38 // CHECK-NEXT: [[T1:%.*]] = bitcast i8* [[T0]] to [[ETY]]*
39 // CHECK-NEXT: [[T2:%.*]] = bitcast [[ETY]]** [[E]] to i8**
40 // CHECK-NEXT: [[T3:%.*]] = bitcast [[ETY]]* [[T1]] to i8*
41 // CHECK-NEXT: call i8* @llvm.objc.initWeak(i8** [[T2]], i8* [[T3]]) [[NUW]]
42 // CHECK-NEXT: [[T0:%.*]] = bitcast [[ETY]]** [[E]] to i8**
43 // CHECK-NEXT: call void @llvm.objc.destroyWeak(i8** [[T0]]) [[NUW]]
44 // CHECK-NEXT: call void @objc_end_catch() [[NUW]]
46 // CHECK: attributes [[NUW]] = { nounwind }