1 // RUN: %clang_cc1 %s -emit-llvm -triple x86_64-apple-macosx10.13.0 -o - | FileCheck %s --check-prefixes=CHECK,NO_EXCEPTIONS
2 // RUN: %clang_cc1 -fexceptions %s -emit-llvm -triple x86_64-apple-macosx10.13.0 -o - | FileCheck %s --check-prefixes=CHECK,EXCEPTIONS
8 // CHECK-NOT: __cxa_atexit{{.*}}_ZN10NonTrivialD1Ev
9 [[clang::no_destroy
]] NonTrivial nt1
;
10 // CHECK-NOT: _tlv_atexit{{.*}}_ZN10NonTrivialD1Ev
11 [[clang::no_destroy
]] thread_local NonTrivial nt2
;
17 // CHECK: __cxa_atexit{{.*}}_ZN11NonTrivial2D1Ev{{.*}}nt21
19 // CHECK: _tlv_atexit{{.*}}_ZN11NonTrivial2D1Ev{{.*}}nt22
20 thread_local NonTrivial2 nt22
;
22 // CHECK-LABEL: define{{.*}} void @_Z1fv
24 // CHECK: __cxa_atexit{{.*}}_ZN11NonTrivial2D1Ev
25 static NonTrivial2 nt21
;
26 // CHECK: _tlv_atexit{{.*}}_ZN11NonTrivial2D1Ev
27 thread_local NonTrivial2 nt22
;
30 // CHECK-LABEL: define{{.*}} void @_Z1gv
32 // CHECK-NOT: __cxa_atexit
33 [[clang::no_destroy
]] static NonTrivial2 nt21
;
34 // CHECK-NOT: _tlv_atexit
35 [[clang::no_destroy
]] thread_local NonTrivial2 nt22
;
38 // CHECK-LABEL: define internal void @__cxx_global_var_init
39 // CHECK: __cxa_atexit{{.*}}_ZN10NonTrivialD1Ev
40 [[clang::always_destroy
]] NonTrivial nt3
;
41 // CHECK-LABEL: define internal void @__cxx_global_var_init
42 // CHECK: _tlv_atexit{{.*}}_ZN10NonTrivialD1Ev
43 [[clang::always_destroy
]] thread_local NonTrivial nt4
;
51 [[clang::no_destroy
]] NonTrivial3 arr
[10];
53 // CHECK-LABEL: define internal void @__cxx_global_var_init
54 // CHECK: {{invoke|call}} void @_ZN11NonTrivial3C1Ev
55 // EXCEPTIONS: call void @_ZN11NonTrivial3D1Ev
56 // NO_EXCEPTIONS-NOT: call void @_ZN11NonTrivial3D1Ev
57 // CHECK-NOT: call i32 @__cxa_atexit
60 [[clang::no_destroy
]] static NonTrivial3 slarr
[10];
63 // CHECK-LABEL: define{{.*}} void @_Z1hv
64 // CHECK: {{invoke|call}} void @_ZN11NonTrivial3C1Ev
65 // EXCEPTIONS: call void @_ZN11NonTrivial3D1Ev
66 // NO_EXCEPTIONS-NOT: call void @_ZN11NonTrivial3D1Ev
67 // CHECK-NOT: call i32 @__cxa_atexit
70 [[clang::no_destroy
]] thread_local NonTrivial3 tlarr
[10];
73 // CHECK-LABEL: define{{.*}} void @_Z1iv
74 // CHECK: {{invoke|call}} void @_ZN11NonTrivial3C1Ev
75 // EXCEPTIONS: call void @_ZN11NonTrivial3D1Ev
76 // NO_EXCEPTIONS-NOT: call void @_ZN11NonTrivial3D1Ev
77 // CHECK-NOT: _tlv_atexit