[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGen / shadowcallstack-attr.c
blob093b2ee9358a289b1d31f5d82686480caa91df80
1 // RUN: %clang_cc1 -triple x86_64-linux-unknown -emit-llvm -o - %s -fsanitize=shadow-call-stack | FileCheck -check-prefix=NOTIGNORELISTED %s
3 // RUN: %clang_cc1 -D ATTR -triple x86_64-linux-unknown -emit-llvm -o - %s -fsanitize=shadow-call-stack | FileCheck -check-prefix=IGNORELISTED %s
5 // RUN: echo -e "[shadow-call-stack]\nfun:foo" > %t
6 // RUN: %clang_cc1 -fsanitize-ignorelist=%t -triple x86_64-linux-unknown -emit-llvm -o - %s -fsanitize=shadow-call-stack | FileCheck -check-prefix=IGNORELISTED %s
8 // RUN: %clang_cc1 -triple riscv32-linux-gnu -emit-llvm -o - %s -fsanitize=shadow-call-stack | FileCheck -check-prefix=NOTIGNORELISTED %s
10 // RUN: %clang_cc1 -D ATTR -triple riscv32-linux-gnu -emit-llvm -o - %s -fsanitize=shadow-call-stack | FileCheck -check-prefix=IGNORELISTED %s
12 // RUN: echo -e "[shadow-call-stack]\nfun:foo" > %t
13 // RUN: %clang_cc1 -fsanitize-ignorelist=%t -triple riscv32-linux-gnu -emit-llvm -o - %s -fsanitize=shadow-call-stack | FileCheck -check-prefix=IGNORELISTED %s
15 // RUN: %clang_cc1 -triple riscv64-linux-gnu -emit-llvm -o - %s -fsanitize=shadow-call-stack | FileCheck -check-prefix=NOTIGNORELISTED %s
17 // RUN: %clang_cc1 -D ATTR -triple riscv64-linux-gnu -emit-llvm -o - %s -fsanitize=shadow-call-stack | FileCheck -check-prefix=IGNORELISTED %s
19 // RUN: echo -e "[shadow-call-stack]\nfun:foo" > %t
20 // RUN: %clang_cc1 -fsanitize-ignorelist=%t -triple riscv64-linux-gnu -emit-llvm -o - %s -fsanitize=shadow-call-stack | FileCheck -check-prefix=IGNORELISTED %s
22 #ifdef ATTR
23 __attribute__((no_sanitize("shadow-call-stack")))
24 #endif
25 int foo(int *a) { return *a; }
27 // CHECK: define i32 @foo(ptr %a)
29 // IGNORELISTED-NOT: attributes {{.*}}shadowcallstack{{.*}}
30 // NOTIGNORELISTED: attributes {{.*}}shadowcallstack{{.*}}