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