[LLVM][IR] Use splat syntax when printing ConstantExpr based splats. (#116856)
[llvm-project.git] / clang / test / CodeGen / hwasan-globals.cpp
blob0ab6025834bff06cc2dae534ad1e9ad8e00e893a
1 // REQUIRES: aarch64-registered-target
3 // RUN: %clang_cc1 -include %S/Inputs/sanitizer-extra-source.cpp \
4 // RUN: -fsanitize-ignorelist=%S/Inputs/sanitizer-ignorelist-global.txt \
5 // RUN: -fsanitize=hwaddress -emit-llvm -triple aarch64-linux-android31 -o -\
6 // RUN: %s | FileCheck %s
8 // RUN: %clang_cc1 -include %S/Inputs/sanitizer-extra-source.cpp \
9 // RUN: -fsanitize-ignorelist=%S/Inputs/sanitizer-ignorelist-src.txt \
10 // RUN: -fsanitize=hwaddress -emit-llvm -triple aarch64-linux-android31 -o -\
11 // RUN: %s | FileCheck %s --check-prefix=IGNORELIST
13 int global;
14 int __attribute__((no_sanitize("hwaddress"))) attributed_global;
15 int __attribute__((disable_sanitizer_instrumentation)) disable_instrumentation_global;
16 int ignorelisted_global;
17 extern int __attribute__((no_sanitize("hwaddress"))) external_global;
19 void func() {
20 static int static_var = 0;
21 const char *literal = "Hello, world!";
22 external_global = 1;
25 // CHECK: @{{.*}}attributed_global{{.*}} ={{.*}} global {{.*}}, no_sanitize_hwaddress
26 // CHECK: @{{.*}}disable_instrumentation_global{{.*}} ={{.*}} global {{.*}}, no_sanitize_hwaddress
27 // CHECK: @{{.*}}ignorelisted_global{{.*}} ={{.*}} global {{.*}}, no_sanitize_hwaddress
28 // CHECK: @{{.*}}external_global{{.*}} ={{.*}}, no_sanitize_hwaddress
29 // CHECK: @{{.*}}extra_global{{.*}}.hwasan{{.*}} =
30 // CHECK: @{{.*}}global{{.*}}.hwasan{{.*}} =
31 // CHECK: @{{.*}}static_var{{.*}}.hwasan{{.*}} =
32 // CHECK: @{{.*}}.hwasan{{.*}} = {{.*}} c"Hello, world!\00"
34 // IGNORELIST: @{{.*}}global{{.*}} ={{.*}} global {{.*}}, no_sanitize_hwaddress
35 // IGNORELIST: @{{.*}}attributed_global{{.*}} ={{.*}} global {{.*}}, no_sanitize_hwaddress
36 // IGNORELIST: @{{.*}}disable_instrumentation_global{{.*}} ={{.*}} global {{.*}}, no_sanitize_hwaddress
37 // IGNORELIST: @{{.*}}ignorelisted_globa{{.*}} ={{.*}} global {{.*}}, no_sanitize_hwaddress
38 // IGNORELIST: @{{.*}}static_var{{.*}} ={{.*}} global {{.*}}, no_sanitize_hwaddress
39 // IGNORELIST: @{{.*}} = {{.*}} c"Hello, world!\00"{{.*}}, no_sanitize_hwaddress
40 // IGNORELIST: @{{.*}}external_global{{.*}} ={{.*}}, no_sanitize_hwaddress
41 // IGNORELIST: @{{.*}}extra_global{{.*}}.hwasan{{.*}} =