[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGen / hwasan-stack-safety-analysis.c
blob6e885cff145db3b9b6e1442b99b72315149ac1f1
1 // REQUIRES: aarch64-registered-target
3 // RUN: %clang -fsanitize=hwaddress -target aarch64-linux-gnu -S -emit-llvm -mllvm -hwasan-use-stack-safety=true -mllvm -hwasan-generate-tags-with-calls -O2 %s -o - | FileCheck %s --check-prefix=SAFETY
4 // RUN: %clang -fsanitize=hwaddress -target aarch64-linux-gnu -S -emit-llvm -mllvm -hwasan-use-stack-safety=false -mllvm -hwasan-generate-tags-with-calls -O2 %s -o - | FileCheck %s --check-prefix=NOSAFETY
6 // Default when optimizing, but not with O0.
7 // RUN: %clang -fsanitize=hwaddress -target aarch64-linux-gnu -S -emit-llvm -mllvm -hwasan-generate-tags-with-calls -O2 %s -o - | FileCheck %s --check-prefix=SAFETY
8 // RUN: %clang -fsanitize=hwaddress -target aarch64-linux-gnu -S -emit-llvm -mllvm -hwasan-generate-tags-with-calls -O0 %s -o - | FileCheck %s --check-prefix=NOSAFETY
10 int main(int argc, char **argv) {
11 char buf[10];
12 volatile char *x = buf;
13 *x = 0;
14 return buf[0];
15 // NOSAFETY: call i8 @__hwasan_generate_tag
16 // SAFETY-NOT: call i8 @__hwasan_generate_tag