Debian Codegraph @

clang/test/CodeGen/lifetime-sanitizer.c

raw
1 // RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -o - -O0 \
2 // RUN: -Xclang -disable-llvm-passes %s | FileCheck %s -check-prefix=CHECK-O0
3 // RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -o - -O0 \
4 // RUN: -fsanitize=address -fsanitize-address-use-after-scope \
5 // RUN: -Xclang -disable-llvm-passes %s | FileCheck %s -check-prefix=LIFETIME
6 // RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -o - -O0 \
7 // RUN: -fsanitize=kernel-address -fsanitize-address-use-after-scope \
8 // RUN: -Xclang -disable-llvm-passes %s | FileCheck %s -check-prefix=LIFETIME
9 // RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -o - -O0 \
10 // RUN: -fsanitize=memory -Xclang -disable-llvm-passes %s | \
11 // RUN: FileCheck %s -check-prefix=LIFETIME
12 // RUN: %clang -target aarch64-linux-gnu -S -emit-llvm -o - -O0 \
13 // RUN: -fsanitize=hwaddress -Xclang -disable-llvm-passes %s | \
14 // RUN: FileCheck %s -check-prefix=LIFETIME
15
16 extern int bar(char *A, int n);
17
18 // CHECK-O0-NOT: @llvm.lifetime.start
19 int foo(int n) {
20 if (n) {
21 // LIFETIME: @llvm.lifetime.start.p0(ptr {{.*}})
22 char A[10];
23 return bar(A, 1);
24 // LIFETIME: @llvm.lifetime.end.p0(ptr {{.*}})
25 } else {
26 // LIFETIME: @llvm.lifetime.start.p0(ptr {{.*}})
27 char A[20];
28 return bar(A, 2);
29 // LIFETIME: @llvm.lifetime.end.p0(ptr {{.*}})
30 }
31 }