[clang] a2095d1 - Allow mangled names in sanitizer clang IR gen tests.

Mitch Phillips via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 28 09:27:54 PDT 2022


Author: Mitch Phillips
Date: 2022-06-28T09:27:43-07:00
New Revision: a2095d1aff847ab7f7035744fb718c32cf680a01

URL: https://github.com/llvm/llvm-project/commit/a2095d1aff847ab7f7035744fb718c32cf680a01
DIFF: https://github.com/llvm/llvm-project/commit/a2095d1aff847ab7f7035744fb718c32cf680a01.diff

LOG: Allow mangled names in sanitizer clang IR gen tests.

Looks like with https://reviews.llvm.org/D127911, Windows emits more
globals with mangled names into the IR. Relax the tests in order to
allow these mangled names.

Added: 
    

Modified: 
    clang/test/CodeGen/asan-globals.cpp
    clang/test/CodeGen/hwasan-globals.cpp

Removed: 
    


################################################################################
diff  --git a/clang/test/CodeGen/asan-globals.cpp b/clang/test/CodeGen/asan-globals.cpp
index 74c461d1cafff..a3b786fe2e5d3 100644
--- a/clang/test/CodeGen/asan-globals.cpp
+++ b/clang/test/CodeGen/asan-globals.cpp
@@ -30,23 +30,23 @@ void func() {
 // GLOBS:     @{{.*}}dyn_init_global{{.*}} ={{.*}} global {{.*}}, sanitize_address_dyninit
 // GLOBS-NOT: no_sanitize_address
 
-// GLOBS:     @attributed_global = global {{.*}} no_sanitize_address
-// GLOBS:     @disable_instrumentation_global = global {{.*}} no_sanitize_address
-// GLOBS:     @ignorelisted_global = global {{.*}} no_sanitize_address
+// GLOBS:     @{{.*}}attributed_global{{.*}} ={{.*}} global {{.*}} no_sanitize_address
+// GLOBS:     @{{.*}}disable_instrumentation_global{{.*}} ={{.*}} global {{.*}} no_sanitize_address
+// GLOBS:     @{{.*}}ignorelisted_global{{.*}} ={{.*}} global {{.*}} no_sanitize_address
 
-// ASAN:     sectioned_global{{.*}} global { i32, [28 x i8] }{{.*}}, align 32
+// ASAN:     @{{.*}}sectioned_global{{.*}} ={{.*}} global { i32, [28 x i8] }{{.*}}, align 32
 // ASAN-NOT: no_sanitize_address
-// ASAN:     @__special_global{{.*}} global { i32, [28 x i8] }{{.*}}, align 32
+// ASAN:     @{{.*}}__special_global{{.*}} ={{.*}} global { i32, [28 x i8] }{{.*}}, align 32
 // ASAN-NOT: no_sanitize_address
 
 /// Note: No attribute is added by the IR pass, but the type didn't change, so
 /// that checks our assertions that the globals didn't get instrumented.
-// KASAN:    sectioned_global{{.*}} global i32 {{.*}}
-// KASAN:    @__special_global{{.*}} global i32 {{.*}}
+// KASAN:    @{{.*}}sectioned_global{{.*}} ={{.*}} global i32 {{.*}}
+// KASAN:    @{{.*}}__special_global{{.*}} ={{.*}} global i32 {{.*}}
 
-// GLOBS:     @{{[^ ]*}}static_var{{[^ ]*}} = internal global {{.*}}
+// GLOBS:     @{{[^ ]*}}static_var{{[^ ]*}} ={{.*}} global {{.*}}
 // GLOBS-NOT: no_sanitize_address
-// GLOBS:     @{{.*}} = internal constant {{.*}}"Hello, world!{{.*}}
+// GLOBS:     @{{.*}} = {{.*}}c"Hello, world!\00"
 // GLOBS-NOT: no_sanitize_address
 
 /// Without -fasynchronous-unwind-tables, ctor and dtor get the uwtable attribute.
@@ -72,14 +72,14 @@ void func() {
 // UWTABLE: attributes #[[#ATTR]] = { nounwind uwtable }
 // UWTABLE: ![[#]] = !{i32 7, !"uwtable", i32 2}
 
-// IGNORELIST-SRC:     @extra_global = global {{.*}}
+// IGNORELIST-SRC:     @{{.*}}extra_global{{.*}} ={{.*}} global
 // IGNORELIST-SRC-NOT: no_sanitize_address
-// IGNORELIST-SRC:     @global = global {{.*}} no_sanitize_address
-// IGNORELIST-SRC:     @dyn_init_global = global {{.*}} no_sanitize_address
-// IGNORELIST-SRC:     @attributed_global = global {{.*}} no_sanitize_address
-// IGNORELIST-SRC:     @disable_instrumentation_global = global {{.*}} no_sanitize_address
-// IGNORELIST-SRC:     @ignorelisted_global = global {{.*}} no_sanitize_address
-// IGNORELIST-SRC:     @sectioned_global = global {{.*}} no_sanitize_address
-// IGNORELIST-SRC:     @__special_global = global {{.*}} no_sanitize_address
-// IGNORELIST-SRC:     @{{[^ ]*}}static_var{{[^ ]*}} = internal global {{.*}} no_sanitize_address
-// IGNORELIST-SRC:     @.str = {{.*}} constant {{.*}}"Hello, world!{{.*}} no_sanitize_address
+// IGNORELIST-SRC:     @{{.*}}global{{.*}} ={{.*}} global {{.*}} no_sanitize_address
+// IGNORELIST-SRC:     @{{.*}}dyn_init_global{{.*}} ={{.*}} global {{.*}} no_sanitize_address
+// IGNORELIST-SRC:     @{{.*}}attributed_global{{.*}} ={{.*}} global {{.*}} no_sanitize_address
+// IGNORELIST-SRC:     @{{.*}}disable_instrumentation_global{{.*}} ={{.*}} global {{.*}} no_sanitize_address
+// IGNORELIST-SRC:     @{{.*}}ignorelisted_global{{.*}} ={{.*}} global {{.*}} no_sanitize_address
+// IGNORELIST-SRC:     @{{.*}}sectioned_global{{.*}} ={{.*}} global {{.*}} no_sanitize_address
+// IGNORELIST-SRC:     @{{.*}}__special_global{{.*}} ={{.*}} global {{.*}} no_sanitize_address
+// IGNORELIST-SRC:     @{{.*}}static_var{{.*}} ={{.*}} global {{.*}} no_sanitize_address
+// IGNORELIST-SRC:     @{{.*}} ={{.*}} c"Hello, world!\00"{{.*}} no_sanitize_address

diff  --git a/clang/test/CodeGen/hwasan-globals.cpp b/clang/test/CodeGen/hwasan-globals.cpp
index a81bcb7110233..d9f2e699c2eff 100644
--- a/clang/test/CodeGen/hwasan-globals.cpp
+++ b/clang/test/CodeGen/hwasan-globals.cpp
@@ -34,4 +34,4 @@ void func() {
 // IGNORELIST: @{{.*}}ignorelisted_globa{{.*}} ={{.*}} global {{.*}}, no_sanitize_hwaddress
 // IGNORELIST: @{{.*}}static_var{{.*}} ={{.*}} global {{.*}}, no_sanitize_hwaddress
 // IGNORELIST: @{{.*}} = {{.*}} c"Hello, world!\00"{{.*}}, no_sanitize_hwaddress
-// IGNORELIST: @extra_global.hwasan =
+// IGNORELIST: @{{.*}}extra_global{{.*}}.hwasan{{.*}} =


        


More information about the cfe-commits mailing list