1 // RUN: %clang_cc1 %s -triple=armv7-apple-darwin10 -emit-llvm -o - -fexceptions -fcxx-exceptions | FileCheck %s 2 3 // Check that we annotate all compiler-synthesized runtime calls and 4 // functions with the actual ABI-determined CC. This usually doesn't 5 // matter as long as we're internally consistent (and the LLVM-default 6 // CC is consistent with the real one), but it's possible for user 7 // translation units to define these runtime functions (or, equivalently, 8 // for us to get LTO'ed with such a translation unit), and then the 9 // mismatch will kill us. 10 // 11 // rdar://12818655 12 13 // CHECK: [[A:%.*]] = type { double } 14 15 namespace test0 { 16 struct A { 17 double d; 18 A(); 19 ~A(); 20 }; 21 22 A global; 23 // CHECK-LABEL: define internal void @__cxx_global_var_init() 24 // CHECK: call [[A]]* @_ZN5test01AC1Ev([[A]]* @_ZN5test06globalE) 25 // CHECK-NEXT: call i32 @__cxa_atexit(void (i8*)* @__cxx_global_array_dtor, i8* null, i8* @__dso_handle) [[NOUNWIND:#[0-9]+]] 26 // CHECK-NEXT: ret void 27 28 // CHECK-LABEL: define internal void @__cxx_global_array_dtor(i8*) 29 // CHECK: call [[A]]* @_ZN5test01AD1Ev([[A]]* @_ZN5test06globalE) 30 // CHECK-NEXT: ret void 31 32 } 33 34 // CHECK: declare i32 @__cxa_atexit(void (i8*)*, i8*, i8*) [[NOUNWIND]] 35 36 namespace test1 { 37 void test() { 38 throw 0; 39 } 40 41 // CHECK-LABEL: define void @_ZN5test14testEv() 42 // CHECK: [[T0:%.*]] = call i8* @__cxa_allocate_exception(i32 4) [[NOUNWIND]] 43 // CHECK-NEXT: [[T1:%.*]] = bitcast i8* [[T0]] to i32* 44 // CHECK-NEXT: store i32 0, i32* [[T1]] 45 // CHECK-NEXT: call void @__cxa_throw(i8* [[T0]], i8* bitcast (i8** @_ZTIi to i8*), i8* null) [[NORETURN:#[0-9]+]] 46 // CHECK-NEXT: unreachable 47 } 48 49 // CHECK: declare i8* @__cxa_allocate_exception(i32) 50 51 // CHECK: declare void @__cxa_throw(i8*, i8*, i8*) 52 53 // CHECK-LABEL: define internal void @_GLOBAL__sub_I_runtimecc.cpp() 54 // CHECK: call void @__cxx_global_var_init() 55 56 57 // CHECK: attributes [[NOUNWIND]] = { nounwind } 58 // CHECK: attributes [[NORETURN]] = { noreturn } 59