Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / sanitize-dtor-vtable.cpp
blob71b5faae6abd5510f40c036f0b8bb267deb0c86d
1 // RUN: %clang_cc1 -O0 -fsanitize=memory -fsanitize-memory-use-after-dtor -disable-llvm-passes -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 -O1 -fsanitize=memory -fsanitize-memory-use-after-dtor -disable-llvm-passes -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 class A {
5 public:
6 int x;
7 A() {}
8 virtual ~A() {}
9 };
10 A a;
12 class B : virtual public A {
13 public:
14 int y;
15 B() {}
16 ~B() {}
18 B b;
20 // CHECK-LABEL: define {{.*}}AD1Ev
21 // CHECK: call void {{.*}}AD2Ev
22 // CHECK: ret void
24 // After invoking base dtor and dtor for virtual base, poison vtable ptr.
25 // CHECK-LABEL: define {{.*}}BD1Ev
26 // CHECK: call void {{.*}}BD2Ev
27 // CHECK: call void {{.*}}AD2Ev
28 // CHECK: call void @__sanitizer_dtor_callback_vptr{{.*}}, !dbg ![[DI1:[0-9]+]]
29 // CHECK: ret void
31 // Since no virtual bases, poison vtable ptr here.
32 // CHECK-LABEL: define {{.*}}AD2Ev
33 // CHECK: call void @__sanitizer_dtor_callback_fields{{.*}}, !dbg ![[DI2:[0-9]+]]
34 // CHECK: call void @__sanitizer_dtor_callback_vptr{{.*}}, !dbg ![[DI3:[0-9]+]]
35 // CHECK: ret void
37 // Poison members
38 // CHECK-LABEL: define {{.*}}BD2Ev
39 // CHECK: call void @__sanitizer_dtor_callback_fields{{.*}}, !dbg ![[DI4:[0-9]+]]
40 // CHECK: ret void
42 // CHECK-LABEL: !DIFile{{.*}}sanitize-dtor-vtable.cpp
44 // CHECK-DAG: ![[DI1]] = {{.*}}line: [[@LINE-28]]
45 // CHECK-DAG: ![[DI2]] = {{.*}}line: [[@LINE-39]]
46 // CHECK-DAG: ![[DI3]] = {{.*}}line: [[@LINE-38]]
47 // CHECK-DAG: ![[DI4]] = {{.*}}line: [[@LINE-33]]