[clang] ed4e95c - [test][msan] Add more Debug Info use-after-dtor tests
Vitaly Buka via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 29 17:50:06 PDT 2022
Author: Vitaly Buka
Date: 2022-08-29T17:49:44-07:00
New Revision: ed4e95c1f68abe8fffe8b54139d268924d554381
URL: https://github.com/llvm/llvm-project/commit/ed4e95c1f68abe8fffe8b54139d268924d554381
DIFF: https://github.com/llvm/llvm-project/commit/ed4e95c1f68abe8fffe8b54139d268924d554381.diff
LOG: [test][msan] Add more Debug Info use-after-dtor tests
Added:
Modified:
clang/test/CodeGenCXX/sanitize-dtor-bit-field.cpp
clang/test/CodeGenCXX/sanitize-dtor-callback.cpp
clang/test/CodeGenCXX/sanitize-dtor-derived-class.cpp
clang/test/CodeGenCXX/sanitize-dtor-nontrivial-virtual-base.cpp
clang/test/CodeGenCXX/sanitize-dtor-trivial-base.cpp
clang/test/CodeGenCXX/sanitize-dtor-trivial.cpp
clang/test/CodeGenCXX/sanitize-dtor-vtable.cpp
Removed:
################################################################################
diff --git a/clang/test/CodeGenCXX/sanitize-dtor-bit-field.cpp b/clang/test/CodeGenCXX/sanitize-dtor-bit-field.cpp
index dc84db879328..f07be7212dad 100644
--- a/clang/test/CodeGenCXX/sanitize-dtor-bit-field.cpp
+++ b/clang/test/CodeGenCXX/sanitize-dtor-bit-field.cpp
@@ -1,6 +1,6 @@
// Test -fsanitize-memory-use-after-dtor
-// RUN: %clang_cc1 -O0 -fsanitize=memory -fsanitize-memory-use-after-dtor -disable-llvm-passes -std=c++11 -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s --implicit-check-not="call void @__sanitizer_"
-// 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 --implicit-check-not="call void @__sanitizer_"
+// 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_"
+// 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_"
// 24 bytes total
struct Packed {
@@ -62,22 +62,28 @@ struct Adjacent {
};
Adjacent ad;
-
// CHECK-LABEL: define {{.*}}PackedD2Ev
-// CHECK: call void @__sanitizer_dtor_callback{{.*}}i64 17
+// CHECK: call void @__sanitizer_dtor_callback{{.*}}i64 17{{.*}}, !dbg ![[DI1:[0-9]+]]
// CHECK: ret void
// CHECK-LABEL: define {{.*}}EmptyD2Ev
// CHECK: ret void
// CHECK-LABEL: define {{.*}}SimpleD2Ev
-// CHECK: call void @__sanitizer_dtor_callback{{.*}}i64 1
+// CHECK: call void @__sanitizer_dtor_callback{{.*}}i64 1{{.*}}, !dbg ![[DI2:[0-9]+]]
// CHECK: ret void
// CHECK-LABEL: define {{.*}}AnonD2Ev
-// CHECK: call void @__sanitizer_dtor_callback{{.*}}i64 5
+// CHECK: call void @__sanitizer_dtor_callback{{.*}}i64 5{{.*}}, !dbg ![[DI3:[0-9]+]]
// CHECK: ret void
// CHECK-LABEL: define {{.*}}AdjacentD2Ev
-// CHECK: call void @__sanitizer_dtor_callback{{.*}}i64 1
+// CHECK: call void @__sanitizer_dtor_callback{{.*}}i64 1{{.*}}, !dbg ![[DI4:[0-9]+]]
// CHECK: ret void
+
+// CHECK-LABEL: !DIFile{{.*}}cpp
+
+// CHECK: ![[DI1]] = {{.*}}line: [[@LINE-68]]
+// CHECK: ![[DI2]] = {{.*}}line: [[@LINE-53]]
+// CHECK: ![[DI3]] = {{.*}}line: [[@LINE-41]]
+// CHECK: ![[DI4]] = {{.*}}line: [[@LINE-28]]
diff --git a/clang/test/CodeGenCXX/sanitize-dtor-callback.cpp b/clang/test/CodeGenCXX/sanitize-dtor-callback.cpp
index f0d1e5697e7a..2aa760ad35f4 100644
--- a/clang/test/CodeGenCXX/sanitize-dtor-callback.cpp
+++ b/clang/test/CodeGenCXX/sanitize-dtor-callback.cpp
@@ -1,5 +1,5 @@
// Test -fsanitize-memory-use-after-dtor
-// RUN: %clang_cc1 -fsanitize=memory -fsanitize-memory-use-after-dtor -std=c++11 -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s --implicit-check-not="call void @__sanitizer_"
+// RUN: %clang_cc1 -fsanitize=memory -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_"
// Sanitizing dtor is emitted in dtor for every class, and only
// poisons once.
@@ -56,14 +56,20 @@ Defaulted_Non_Trivial def_non_trivial;
// instrumentation inserted.
// CHECK-LABEL: define {{.*}}SimpleD2Ev
// CHECK-NOT: store i{{[0-9]+}} 0, {{.*}}@__msan_param_tls
-// CHECK: call void @__sanitizer_dtor_callback
+// CHECK: call void @__sanitizer_dtor_callback{{.*}}, !dbg ![[DI1:[0-9]+]]
// CHECK: ret void
// CHECK-LABEL: define {{.*}}InlinedD2Ev
// CHECK-NOT: store i{{[0-9]+}} 0, {{.*}}@__msan_param_tls
-// CHECK: call void @__sanitizer_dtor_callback
+// CHECK: call void @__sanitizer_dtor_callback{{.*}}, !dbg ![[DI2:[0-9]+]]
// CHECK: ret void
// CHECK-LABEL: define {{.*}}Defaulted_Non_TrivialD2Ev
-// CHECK: call void @__sanitizer_dtor_callback
+// CHECK: call void @__sanitizer_dtor_callback{{.*}}, !dbg ![[DI3:[0-9]+]]
// CHECK: ret void
+
+// CHECK-LABEL: !DIFile{{.*}}cpp
+
+// CHECK: ![[DI1]] = {{.*}}line: [[@LINE-64]]
+// CHECK: ![[DI2]] = {{.*}}line: [[@LINE-55]]
+// CHECK: ![[DI3]] = {{.*}}line: [[@LINE-33]]
diff --git a/clang/test/CodeGenCXX/sanitize-dtor-derived-class.cpp b/clang/test/CodeGenCXX/sanitize-dtor-derived-class.cpp
index 0a6aacb84d41..3292e87ea7c3 100644
--- a/clang/test/CodeGenCXX/sanitize-dtor-derived-class.cpp
+++ b/clang/test/CodeGenCXX/sanitize-dtor-derived-class.cpp
@@ -1,5 +1,5 @@
-// 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 --implicit-check-not="call void @__sanitizer_"
-// 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 --implicit-check-not="call void @__sanitizer_"
+// RUN: %clang_cc1 -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_"
+// 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_"
// Base dtor poisons members
// Complete dtor poisons vtable ptr after destroying members and
@@ -49,13 +49,18 @@ Derived d;
// Poison members and vtable ptr.
// CHECK-LABEL: define {{.*}}BaseD2Ev
-// CHECK: call void @__sanitizer_dtor_callback
-// CHECK: call void @__sanitizer_dtor_callback{{.*}}i64 8
+// CHECK: call void @__sanitizer_dtor_callback{{.*}}, !dbg ![[DI1:[0-9]+]]
+// CHECK: call void @__sanitizer_dtor_callback{{.*}}i64 8{{.*}}, !dbg ![[DI1]]
// CHECK: ret void
// Poison members and destroy non-virtual base.
// CHECK-LABEL: define {{.*}}DerivedD2Ev
-// CHECK: call void @__sanitizer_dtor_callback
+// CHECK: call void @__sanitizer_dtor_callback{{.*}}, !dbg ![[DI3:[0-9]+]]
// CHECK: call void {{.*}}BaseD2Ev
-// CHECK: call void @__sanitizer_dtor_callback{{.*}}i64 8
+// CHECK: call void @__sanitizer_dtor_callback{{.*}}i64 8{{.*}}, !dbg ![[DI3]]
// CHECK: ret void
+
+// CHECK-LABEL: !DIFile{{.*}}cpp
+
+// CHECK: ![[DI1]] = {{.*}}line: [[@LINE-49]]
+// CHECK: ![[DI3]] = {{.*}}line: [[@LINE-39]]
diff --git a/clang/test/CodeGenCXX/sanitize-dtor-nontrivial-virtual-base.cpp b/clang/test/CodeGenCXX/sanitize-dtor-nontrivial-virtual-base.cpp
index c75def6f9ef3..3e20eede26b1 100644
--- a/clang/test/CodeGenCXX/sanitize-dtor-nontrivial-virtual-base.cpp
+++ b/clang/test/CodeGenCXX/sanitize-dtor-nontrivial-virtual-base.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -fsanitize=memory -O0 -fsanitize-memory-use-after-dtor -std=c++11 -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s --implicit-check-not="call void @__sanitizer_"
-// RUN: %clang_cc1 -fsanitize=memory -O1 -disable-llvm-passes -fsanitize-memory-use-after-dtor -std=c++11 -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s --implicit-check-not="call void @__sanitizer_"
+// 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_"
+// 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_"
template <class T>
class Vector {
@@ -61,25 +61,32 @@ Derived d;
// poison 2 ints
// CHECK-LABEL: define {{.*}}ZN11VirtualBaseD2Ev
-// CHECK: call void {{.*}}sanitizer_dtor_callback({{.*}}, i64 8)
+// CHECK: call void {{.*}}@__sanitizer_dtor_callback({{.*}}, i64 8){{.*}}, !dbg ![[DI1:[0-9]+]]
// CHECK: call void {{.*}}sanitizer_dtor_callback({{.*}}, i64 8)
// CHECK: ret void
// poison int and double
// CHECK-LABEL: define {{.*}}ZN4BaseD2Ev
-// CHECK: call void {{.*}}sanitizer_dtor_callback({{.*}}, i64 16)
+// CHECK: call void @__sanitizer_dtor_callback({{.*}}{{.*}}, !dbg ![[DI2:[0-9]+]]
// CHECK: call void {{.*}}sanitizer_dtor_callback({{.*}}, i64 8)
// CHECK: ret void
// poison int, ignore vector, poison int
// CHECK-LABEL: define {{.*}}ZN7DerivedD2Ev
-// CHECK: call void {{.*}}sanitizer_dtor_callback({{.*}}, i64 4)
+// CHECK: call void {{.*}}sanitizer_dtor_callback({{.*}}, i64 4){{.*}}, !dbg ![[DI3:[0-9]+]]
// CHECK: call void {{.*}}ZN6VectorIiED1Ev
-// CHECK: call void {{.*}}sanitizer_dtor_callback({{.*}}, i64 4)
+// CHECK: call void {{.*}}sanitizer_dtor_callback({{.*}}, i64 4){{.*}}, !dbg ![[DI3]]
// CHECK: call void {{.*}}ZN4BaseD2Ev
// CHECK: ret void
// poison int
// CHECK-LABEL: define {{.*}}ZN6VectorIiED2Ev
-// CHECK: call void {{.*}}sanitizer_dtor_callback({{.*}}, i64 4)
+// CHECK: call void {{.*}}sanitizer_dtor_callback({{.*}}, i64 4){{.*}}, !dbg ![[DI5:[0-9]+]]
// CHECK: ret void
+
+// CHECK-LABEL: !DIFile{{.*}}.cpp
+
+// CHECK: ![[DI1]] = {{.*}}line: [[@LINE-59]]
+// CHECK: ![[DI2]] = {{.*}}line: [[@LINE-70]]
+// CHECK: ![[DI3]] = {{.*}}line: [[@LINE-51]]
+// CHECK: ![[DI5]] = {{.*}}line: [[@LINE-82]]
diff --git a/clang/test/CodeGenCXX/sanitize-dtor-trivial-base.cpp b/clang/test/CodeGenCXX/sanitize-dtor-trivial-base.cpp
index 7584fc02cd8e..4c4d8805f9c7 100644
--- a/clang/test/CodeGenCXX/sanitize-dtor-trivial-base.cpp
+++ b/clang/test/CodeGenCXX/sanitize-dtor-trivial-base.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -no-opaque-pointers -fsanitize=memory -fsanitize-memory-use-after-dtor -disable-llvm-passes -std=c++11 -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s --implicit-check-not="call void @__sanitizer_"
-// RUN: %clang_cc1 -no-opaque-pointers -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 --implicit-check-not="call void @__sanitizer_"
+// RUN: %clang_cc1 -no-opaque-pointers -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_"
+// RUN: %clang_cc1 -no-opaque-pointers -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_"
// Base class has trivial dtor => complete dtor poisons base class memory directly.
@@ -20,6 +20,10 @@ Derived d;
// Poison members, then poison the trivial base class.
// CHECK-LABEL: define {{.*}}DerivedD2Ev
// CHECK: %[[GEP:[0-9a-z]+]] = getelementptr i8, i8* {{.*}}, i64 16
-// CHECK: call void @__sanitizer_dtor_callback{{.*}}%[[GEP]], i64 4
-// CHECK: call void @__sanitizer_dtor_callback{{.*}}, i64 16
+// CHECK: call void @__sanitizer_dtor_callback{{.*}}%[[GEP]], i64 4{{.*}}, !dbg ![[DI:[0-9]+]]
+// CHECK: call void @__sanitizer_dtor_callback{{.*}}, i64 16{{.*}}, !dbg ![[DI]]
// CHECK: ret void
+
+// CHECK-LABEL: !DIFile{{.*}}cpp
+
+// CHECK: ![[DI]] = {{.*}}line: [[@LINE-14]]
diff --git a/clang/test/CodeGenCXX/sanitize-dtor-trivial.cpp b/clang/test/CodeGenCXX/sanitize-dtor-trivial.cpp
index 980f833487c0..302633acdadf 100644
--- a/clang/test/CodeGenCXX/sanitize-dtor-trivial.cpp
+++ b/clang/test/CodeGenCXX/sanitize-dtor-trivial.cpp
@@ -1,6 +1,6 @@
// Test -fsanitize-memory-use-after-dtor
-// RUN: %clang_cc1 -O0 -fsanitize=memory -fsanitize-memory-use-after-dtor -disable-llvm-passes -std=c++11 -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s --implicit-check-not="call void @__sanitizer_"
-// 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 --implicit-check-not="call void @__sanitizer_"
+// 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_"
+// 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_"
// TODO Success pending on resolution of issue:
// https://github.com/google/sanitizers/issues/596
@@ -12,4 +12,8 @@ struct Trivial {
};
Trivial t;
-// CHECK: call void @__sanitizer_dtor_callback
+// CHECK: call void @__sanitizer_dtor_callback{{.*}}, !dbg ![[DI:[0-9]+]]
+
+// CHECK-LABEL: !DIFile{{.*}}.cpp
+
+// CHECK: ![[DI]] = {{.*}}line: [[@LINE-371]]
diff --git a/clang/test/CodeGenCXX/sanitize-dtor-vtable.cpp b/clang/test/CodeGenCXX/sanitize-dtor-vtable.cpp
index afb8f9d0d123..a63d4bf75f44 100644
--- a/clang/test/CodeGenCXX/sanitize-dtor-vtable.cpp
+++ b/clang/test/CodeGenCXX/sanitize-dtor-vtable.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -O0 -fsanitize=memory -fsanitize-memory-use-after-dtor -disable-llvm-passes -std=c++11 -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s --implicit-check-not="call void @__sanitizer_"
-// 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 --implicit-check-not="call void @__sanitizer_"
+// 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_"
+// 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_"
class A {
public:
@@ -25,16 +25,22 @@ B b;
// CHECK-LABEL: define {{.*}}BD1Ev
// CHECK: call void {{.*}}BD2Ev
// CHECK: call void {{.*}}AD2Ev
-// CHECK: call void @__sanitizer_dtor_callback{{.*}}i64 8
+// CHECK: call void @__sanitizer_dtor_callback{{.*}}, !dbg ![[DI1:[0-9]+]]
// CHECK: ret void
// Since no virtual bases, poison vtable ptr here.
// CHECK-LABEL: define {{.*}}AD2Ev
-// CHECK: call void @__sanitizer_dtor_callback
-// CHECK: call void @__sanitizer_dtor_callback{{.*}}i64 8
+// CHECK: call void @__sanitizer_dtor_callback{{.*}}, !dbg ![[DI2:[0-9]+]]
+// CHECK: call void @__sanitizer_dtor_callback{{.*}}, !dbg ![[DI2]]
// CHECK: ret void
// Poison members
// CHECK-LABEL: define {{.*}}BD2Ev
-// CHECK: call void @__sanitizer_dtor_callback
+// CHECK: call void @__sanitizer_dtor_callback{{.*}}, !dbg ![[DI4:[0-9]+]]
// CHECK: ret void
+
+// CHECK-LABEL: !DIFile{{.*}}cpp
+
+// CHECK: ![[DI1]] = {{.*}}line: [[@LINE-28]]
+// CHECK: ![[DI2]] = {{.*}}line: [[@LINE-37]]
+// CHECK: ![[DI4]] = {{.*}}line: [[@LINE-30]]
More information about the cfe-commits
mailing list