[clang-cl] Ignore /Wv and /Wv:17 flags
[llvm-project.git] / clang / test / CodeGenCXX / sanitize-dtor-derived-class.cpp
blob618096aeebd7d16e9eb0adb4d974d6a4d3dd7f68
1 // RUN: %clang_cc1 -fsanitize=memory -fsanitize-memory-use-after-dtor -disable-llvm-passes -std=c++11 -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s
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 -o - %s | FileCheck %s
4 // Base dtor poisons members
5 // Complete dtor poisons vtable ptr after destroying members and
6 // virtual bases
8 class Base {
9 public:
10 int x;
11 Base() {
12 x = 5;
14 virtual ~Base() {
15 x += 1;
19 class Derived : public Base {
20 public:
21 int y;
22 Derived() {
23 y = 10;
25 ~Derived() {
26 y += 1;
30 Derived d;
32 // Invoke base destructor. No vtable pointer to poison.
33 // CHECK-LABEL: define {{.*}}DerivedD1Ev
34 // CHECK-NOT: call void @__sanitizer_dtor_callback
35 // CHECK: call void {{.*}}DerivedD2Ev
36 // CHECK-NOT: call void @__sanitizer_dtor_callback
37 // CHECK: ret void
39 // CHECK-LABEL: define {{.*}}DerivedD0Ev
40 // CHECK-NOT: call void @__sanitizer_dtor_callback
41 // CHECK: call void {{.*}}DerivedD1Ev
42 // CHECK-NOT: call void @__sanitizer_dtor_callback
43 // CHECK: ret void
45 // Invokes base destructor, and poison vtable pointer.
46 // CHECK-LABEL: define {{.*}}BaseD1Ev
47 // CHECK-NOT: call void @__sanitizer_dtor_callback
48 // CHECK: call void {{.*}}BaseD2Ev
49 // CHECK-NOT: call void @__sanitizer_dtor_callback
50 // CHECK: ret void
52 // CHECK-LABEL: define {{.*}}BaseD0Ev
53 // CHECK-NOT: call void @__sanitizer_dtor_callback
54 // CHECK: call void {{.*}}BaseD1Ev
55 // CHECK-NOT: call void @__sanitizer_dtor_callback
56 // CHECK: ret void
58 // Poison members and vtable ptr.
59 // CHECK-LABEL: define {{.*}}BaseD2Ev
60 // CHECK: call void @__sanitizer_dtor_callback
61 // CHECK: call void @__sanitizer_dtor_callback{{.*}}i64 8
62 // CHECK-NOT: call void @__sanitizer_dtor_callback
63 // CHECK: ret void
65 // Poison members and destroy non-virtual base.
66 // CHECK-LABEL: define {{.*}}DerivedD2Ev
67 // CHECK: call void @__sanitizer_dtor_callback
68 // CHECK-NOT: call void @__sanitizer_dtor_callback
69 // CHECK: call void {{.*}}BaseD2Ev
70 // CHECK: call void @__sanitizer_dtor_callback{{.*}}i64 8
71 // CHECK: ret void