1// RUN: %clang_cc1 -triple arm64-apple-ios11 -fobjc-arc -fblocks -fobjc-runtime=ios-11.0 -fobjc-exceptions -fexceptions -emit-llvm -o - %s | FileCheck %s 2 3// CHECK: %[[STRUCT_STRONG:.*]] = type { i32, i8* } 4// CHECK: %[[STRUCT_WEAK:.*]] = type { i32, i8* } 5 6typedef struct { 7 int i; 8 id f1; 9} Strong; 10 11typedef struct { 12 int i; 13 __weak id f1; 14} Weak; 15 16// CHECK: define void @testStrongException() 17// CHECK: %[[AGG_TMP:.*]] = alloca %[[STRUCT_STRONG]], align 8 18// CHECK: %[[AGG_TMP1:.*]] = alloca %[[STRUCT_STRONG]], align 8 19// CHECK: %[[CALL:.*]] = call [2 x i64] @genStrong() 20// CHECK: %[[V0:.*]] = bitcast %[[STRUCT_STRONG]]* %[[AGG_TMP]] to [2 x i64]* 21// CHECK: store [2 x i64] %[[CALL]], [2 x i64]* %[[V0]], align 8 22// CHECK: invoke [2 x i64] @genStrong() 23 24// CHECK: call void @calleeStrong([2 x i64] %{{.*}}, [2 x i64] %{{.*}}) 25// CHECK-NEXT: ret void 26 27// CHECK: landingpad { i8*, i32 } 28// CHECK: %[[V9:.*]] = bitcast %[[STRUCT_STRONG]]* %[[AGG_TMP]] to i8** 29// CHECK: call void @__destructor_8_s8(i8** %[[V9]]) 30// CHECK: br label 31 32// CHECK: resume 33 34Strong genStrong(void); 35void calleeStrong(Strong, Strong); 36 37void testStrongException(void) { 38 calleeStrong(genStrong(), genStrong()); 39} 40 41// CHECK: define void @testWeakException() 42// CHECK: %[[AGG_TMP:.*]] = alloca %[[STRUCT_WEAK]], align 8 43// CHECK: %[[AGG_TMP1:.*]] = alloca %[[STRUCT_WEAK]], align 8 44// CHECK: call void @genWeak(%[[STRUCT_WEAK]]* sret %[[AGG_TMP]]) 45// CHECK: invoke void @genWeak(%[[STRUCT_WEAK]]* sret %[[AGG_TMP1]]) 46 47// CHECK: call void @calleeWeak(%[[STRUCT_WEAK]]* %[[AGG_TMP]], %[[STRUCT_WEAK]]* %[[AGG_TMP1]]) 48// CHECK: ret void 49 50// CHECK: landingpad { i8*, i32 } 51// CHECK: %[[V3:.*]] = bitcast %[[STRUCT_WEAK]]* %[[AGG_TMP]] to i8** 52// CHECK: call void @__destructor_8_w8(i8** %[[V3]]) 53// CHECK: br label 54 55// CHECK: resume 56 57Weak genWeak(void); 58void calleeWeak(Weak, Weak); 59 60void testWeakException(void) { 61 calleeWeak(genWeak(), genWeak()); 62} 63