[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGen / uwtable-attr.c
blob12ec158272ae8a2ac3af10fbda49788ad759ef3e
1 // Test that function and modules attributes react on the command-line options,
2 // it does not state the current behaviour makes sense in all cases (it does not).
4 // RUN: %clang -target x86_64-linux -S -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,DEFAULT
5 // RUN: %clang -target x86_64-linux -S -emit-llvm -o - %s -funwind-tables -fno-asynchronous-unwind-tables | FileCheck %s -check-prefixes=CHECK,TABLES
6 // RUN: %clang -target x86_64-linux -S -emit-llvm -o - %s -fno-unwind-tables -fno-asynchronous-unwind-tables | FileCheck %s -check-prefixes=CHECK,NO_TABLES
8 // RUN: %clang -target x86_64-linux -S -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,DEFAULT
9 // RUN: %clang -target x86_64-linux -S -emit-llvm -o - -x c++ %s -funwind-tables -fno-asynchronous-unwind-tables | FileCheck %s -check-prefixes=CHECK,TABLES
10 // RUN: %clang -target x86_64-linux -S -emit-llvm -o - -x c++ %s -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables | FileCheck %s -check-prefixes=CHECK,NO_TABLES
12 // REQUIRES: x86-registered-target
14 #ifdef __cplusplus
15 extern "C" void g(void);
16 struct S { ~S(); };
17 extern "C" int f() { S s; g(); return 0;};
18 #else
19 void g(void);
20 int f(void) { g(); return 0; };
21 #endif
23 // CHECK: define {{.*}} @f() #[[#F:]]
24 // CHECK: declare {{.*}} @g() #[[#]]
26 // DEFAULT: attributes #[[#F]] = { {{.*}} uwtable{{ }}{{.*}} }
27 // DEFAULT: ![[#]] = !{i32 7, !"uwtable", i32 2}
29 // TABLES: attributes #[[#F]] = { {{.*}} uwtable(sync){{.*}} }
30 // TABLES: ![[#]] = !{i32 7, !"uwtable", i32 1}
32 // NO_TABLES-NOT: uwtable