[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / CodeGenCXX / sanitize-dtor-nontrivial-virtual-base.cpp
blob0795e75c3642309b8f7255c444410eb75d6cc361
1 // RUN: %clang_cc1 -fsanitize=memory -O0 -fsanitize-memory-use-after-dtor -std=c++11 -triple=x86_64-pc-linux -emit-llvm -debug-info-kind=line-tables-only -o - %s | FileCheck %s --implicit-check-not="call void @__sanitizer_"
2 // RUN: %clang_cc1 -fsanitize=memory -O1 -disable-llvm-passes -fsanitize-memory-use-after-dtor -std=c++11 -triple=x86_64-pc-linux -emit-llvm -debug-info-kind=line-tables-only -o - %s | FileCheck %s --implicit-check-not="call void @__sanitizer_"
4 template <class T>
5 class Vector {
6 public:
7 int size;
8 ~Vector() {
9 size += 1;
13 struct Base {
14 int b1;
15 double b2;
16 Base() {
17 b1 = 5;
18 b2 = 10.989;
20 virtual ~Base() {}
23 struct VirtualBase {
24 int vb1;
25 int vb2;
26 VirtualBase() {
27 vb1 = 10;
28 vb2 = 11;
30 virtual ~VirtualBase() {}
33 struct Derived : public Base, public virtual VirtualBase {
34 int d1;
35 Vector<int> v;
36 int d2;
37 Derived() {
38 d1 = 10;
40 ~Derived() {}
43 Derived d;
45 // Destruction order:
46 // Derived: int, Vector, Base, VirtualBase
48 // CHECK-LABEL: define {{.*}}ZN7DerivedD1Ev
49 // CHECK: call void {{.*}}ZN11VirtualBaseD2Ev
50 // CHECK: call void @__sanitizer_dtor_callback_vptr({{.*}}){{.*}}, !dbg ![[DI0:[0-9]+]]
51 // CHECK: ret void
53 // CHECK-LABEL: define {{.*}}ZN7DerivedD0Ev
54 // CHECK: ret void
56 // CHECK-LABEL: define {{.*}}ZN11VirtualBaseD1Ev
57 // CHECK: ret void
59 // CHECK-LABEL: define {{.*}}ZN11VirtualBaseD0Ev
60 // CHECK: ret void
62 // poison 2 ints
63 // CHECK-LABEL: define {{.*}}ZN11VirtualBaseD2Ev
64 // CHECK: call void @__sanitizer_dtor_callback_fields({{.*}}, i64 8){{.*}}, !dbg ![[DI1:[0-9]+]]
65 // CHECK: call void @__sanitizer_dtor_callback_vptr({{.*}}){{.*}}{{.*}}, !dbg ![[DI2:[0-9]+]]
66 // CHECK: ret void
68 // poison int and double
69 // CHECK-LABEL: define {{.*}}ZN4BaseD2Ev
70 // CHECK: call void @__sanitizer_dtor_callback_fields({{.*}}, i64 16){{.*}}, !dbg ![[DI3:[0-9]+]]
71 // CHECK: call void @__sanitizer_dtor_callback_vptr({{.*}}{{.*}}, !dbg ![[DI4:[0-9]+]]
72 // CHECK: ret void
74 // poison int, ignore vector, poison int
75 // CHECK-LABEL: define {{.*}}ZN7DerivedD2Ev
76 // CHECK: call void @__sanitizer_dtor_callback_fields({{.*}}, i64 4){{.*}}, !dbg ![[DI5:[0-9]+]]
77 // CHECK: call void {{.*}}ZN6VectorIiED1Ev
78 // CHECK: call void @__sanitizer_dtor_callback_fields({{.*}}, i64 4){{.*}}, !dbg ![[DI6:[0-9]+]]
79 // CHECK: call void {{.*}}ZN4BaseD2Ev
80 // CHECK: ret void
82 // poison int
83 // CHECK-LABEL: define {{.*}}ZN6VectorIiED2Ev
84 // CHECK: call void @__sanitizer_dtor_callback_fields({{.*}}, i64 4){{.*}}, !dbg ![[DI7:[0-9]+]]
85 // CHECK: ret void
87 // CHECK-LABEL: !DIFile{{.*}}.cpp
89 // CHECK-DAG: ![[DI0]] = {{.*}}line: [[@LINE-49]]
90 // CHECK-DAG: ![[DI1]] = {{.*}}line: [[@LINE-66]]
91 // CHECK-DAG: ![[DI2]] = {{.*}}line: [[@LINE-61]]
92 // CHECK-DAG: ![[DI3]] = {{.*}}line: [[@LINE-78]]
93 // CHECK-DAG: ![[DI5]] = {{.*}}line: [[@LINE-57]]
94 // CHECK-DAG: ![[DI6]] = {{.*}}line: [[@LINE-60]]
95 // CHECK-DAG: ![[DI7]] = {{.*}}line: [[@LINE-88]]