Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / always_destroy.cpp
blobe84c4cf02c52f5b64c659503136590354d81113e
1 // RUN: %clang_cc1 %s -fno-c++-static-destructors -emit-llvm -triple x86_64-apple-macosx10.13.0 -o - | FileCheck %s
3 struct NonTrivial {
4 ~NonTrivial();
5 };
7 // CHECK-NOT: __cxa_atexit{{.*}}_ZN10NonTrivialD1Ev
8 NonTrivial nt1;
9 // CHECK-NOT: _tlv_atexit{{.*}}_ZN10NonTrivialD1Ev
10 thread_local NonTrivial nt2;
12 struct NonTrivial2 {
13 ~NonTrivial2();
16 // CHECK: __cxa_atexit{{.*}}_ZN11NonTrivial2D1Ev
17 [[clang::always_destroy]] NonTrivial2 nt21;
18 // CHECK: _tlv_atexit{{.*}}_ZN11NonTrivial2D1Ev
19 [[clang::always_destroy]] thread_local NonTrivial2 nt22;
21 void f() {
22 // CHECK: __cxa_atexit{{.*}}_ZN11NonTrivial2D1Ev
23 [[clang::always_destroy]] static NonTrivial2 nt21;
24 // CHECK: _tlv_atexit{{.*}}_ZN11NonTrivial2D1Ev
25 [[clang::always_destroy]] thread_local NonTrivial2 nt22;
28 // CHECK-NOT: __cxa_atexit{{.*}}_ZN10NonTrivialD1Ev
29 [[clang::no_destroy]] NonTrivial nt3;
30 // CHECK-NOT: _tlv_atexit{{.*}}_ZN10NonTrivialD1Ev
31 [[clang::no_destroy]] thread_local NonTrivial nt4;