annotate clang/test/CodeGenCXX/sanitize-dtor-derived-class.cpp @ 206:f17a3b42b08b

Added tag before-12 for changeset b7591485f4cd
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 07 Jun 2021 21:25:57 +0900
parents 1d019706d866
children c4bab56944e8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
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
anatofuz
parents:
diff changeset
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
anatofuz
parents:
diff changeset
3
anatofuz
parents:
diff changeset
4 // Base dtor poisons members
anatofuz
parents:
diff changeset
5 // Complete dtor poisons vtable ptr after destroying members and
anatofuz
parents:
diff changeset
6 // virtual bases
anatofuz
parents:
diff changeset
7
anatofuz
parents:
diff changeset
8 class Base {
anatofuz
parents:
diff changeset
9 public:
anatofuz
parents:
diff changeset
10 int x;
anatofuz
parents:
diff changeset
11 Base() {
anatofuz
parents:
diff changeset
12 x = 5;
anatofuz
parents:
diff changeset
13 }
anatofuz
parents:
diff changeset
14 virtual ~Base() {
anatofuz
parents:
diff changeset
15 x += 1;
anatofuz
parents:
diff changeset
16 }
anatofuz
parents:
diff changeset
17 };
anatofuz
parents:
diff changeset
18
anatofuz
parents:
diff changeset
19 class Derived : public Base {
anatofuz
parents:
diff changeset
20 public:
anatofuz
parents:
diff changeset
21 int y;
anatofuz
parents:
diff changeset
22 Derived() {
anatofuz
parents:
diff changeset
23 y = 10;
anatofuz
parents:
diff changeset
24 }
anatofuz
parents:
diff changeset
25 ~Derived() {
anatofuz
parents:
diff changeset
26 y += 1;
anatofuz
parents:
diff changeset
27 }
anatofuz
parents:
diff changeset
28 };
anatofuz
parents:
diff changeset
29
anatofuz
parents:
diff changeset
30 Derived d;
anatofuz
parents:
diff changeset
31
anatofuz
parents:
diff changeset
32 // Invoke base destructor. No vtable pointer to poison.
anatofuz
parents:
diff changeset
33 // CHECK-LABEL: define {{.*}}DerivedD1Ev
anatofuz
parents:
diff changeset
34 // CHECK-NOT: call void @__sanitizer_dtor_callback
anatofuz
parents:
diff changeset
35 // CHECK: call void {{.*}}DerivedD2Ev
anatofuz
parents:
diff changeset
36 // CHECK-NOT: call void @__sanitizer_dtor_callback
anatofuz
parents:
diff changeset
37 // CHECK: ret void
anatofuz
parents:
diff changeset
38
anatofuz
parents:
diff changeset
39 // CHECK-LABEL: define {{.*}}DerivedD0Ev
anatofuz
parents:
diff changeset
40 // CHECK-NOT: call void @__sanitizer_dtor_callback
anatofuz
parents:
diff changeset
41 // CHECK: call void {{.*}}DerivedD1Ev
anatofuz
parents:
diff changeset
42 // CHECK-NOT: call void @__sanitizer_dtor_callback
anatofuz
parents:
diff changeset
43 // CHECK: ret void
anatofuz
parents:
diff changeset
44
anatofuz
parents:
diff changeset
45 // Invokes base destructor, and poison vtable pointer.
anatofuz
parents:
diff changeset
46 // CHECK-LABEL: define {{.*}}BaseD1Ev
anatofuz
parents:
diff changeset
47 // CHECK-NOT: call void @__sanitizer_dtor_callback
anatofuz
parents:
diff changeset
48 // CHECK: call void {{.*}}BaseD2Ev
anatofuz
parents:
diff changeset
49 // CHECK-NOT: call void @__sanitizer_dtor_callback
anatofuz
parents:
diff changeset
50 // CHECK: ret void
anatofuz
parents:
diff changeset
51
anatofuz
parents:
diff changeset
52 // CHECK-LABEL: define {{.*}}BaseD0Ev
anatofuz
parents:
diff changeset
53 // CHECK-NOT: call void @__sanitizer_dtor_callback
anatofuz
parents:
diff changeset
54 // CHECK: call void {{.*}}BaseD1Ev
anatofuz
parents:
diff changeset
55 // CHECK-NOT: call void @__sanitizer_dtor_callback
anatofuz
parents:
diff changeset
56 // CHECK: ret void
anatofuz
parents:
diff changeset
57
anatofuz
parents:
diff changeset
58 // Poison members and vtable ptr.
anatofuz
parents:
diff changeset
59 // CHECK-LABEL: define {{.*}}BaseD2Ev
anatofuz
parents:
diff changeset
60 // CHECK: call void @__sanitizer_dtor_callback
anatofuz
parents:
diff changeset
61 // CHECK: call void @__sanitizer_dtor_callback{{.*}}i64 8
anatofuz
parents:
diff changeset
62 // CHECK-NOT: call void @__sanitizer_dtor_callback
anatofuz
parents:
diff changeset
63 // CHECK: ret void
anatofuz
parents:
diff changeset
64
anatofuz
parents:
diff changeset
65 // Poison members and destroy non-virtual base.
anatofuz
parents:
diff changeset
66 // CHECK-LABEL: define {{.*}}DerivedD2Ev
anatofuz
parents:
diff changeset
67 // CHECK: call void @__sanitizer_dtor_callback
anatofuz
parents:
diff changeset
68 // CHECK-NOT: call void @__sanitizer_dtor_callback
anatofuz
parents:
diff changeset
69 // CHECK: call void {{.*}}BaseD2Ev
anatofuz
parents:
diff changeset
70 // CHECK: call void @__sanitizer_dtor_callback{{.*}}i64 8
anatofuz
parents:
diff changeset
71 // CHECK: ret void