[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGen / bpf-stack-protector.c
blobf79a49e6aa686df18c73917dc41527c42908acca
1 // REQUIRES: bpf-registered-target
3 // RUN: %clang -target bpf -S -emit-llvm -o - %s -fno-stack-protector 2>&1 \
4 // RUN: | FileCheck -check-prefix=OFF -check-prefix=COMMON %s
6 // RUN: %clang -target bpf -S -emit-llvm -o - %s -fstack-protector 2>&1 \
7 // RUN: | FileCheck -check-prefix=ON -check-prefix=COMMON -check-prefix=WARNING %s
9 // RUN: %clang -target bpf -S -emit-llvm -o - %s -fstack-protector-all 2>&1 \
10 // RUN: | FileCheck -check-prefix=ALL -check-prefix=COMMON -check-prefix=WARNING %s
12 // RUN: %clang -target bpf -S -emit-llvm -o - %s -fstack-protector-strong 2>&1 \
13 // RUN: | FileCheck -check-prefix=STRONG -check-prefix=COMMON -check-prefix=WARNING %s
15 typedef __SIZE_TYPE__ size_t;
17 int printf(const char * _Format, ...);
18 size_t strlen(const char *s);
19 char *strcpy(char *s1, const char *s2);
21 // OFF-NOT: warning
22 // ON: warning: ignoring '-fstack-protector'
23 // ALL: warning: ignoring '-fstack-protector-all'
24 // STRONG: warning: ignoring '-fstack-protector-strong'
25 // WARNING-SAME: option as it is not currently supported for target 'bpf'
27 // COMMON: define {{.*}}void @test1(ptr noundef %{{[0-9a-z]+}}) #[[A:.*]] {
28 void test1(const char *msg) {
29 char a[strlen(msg) + 1];
30 strcpy(a, msg);
31 printf("%s\n", a);
34 // COMMON-NOT: attributes #[[A]] = {{.*}} ssp