diff options
Diffstat (limited to 'clang/test/CodeGen/uwtable-attr.c')
-rw-r--r-- | clang/test/CodeGen/uwtable-attr.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/clang/test/CodeGen/uwtable-attr.c b/clang/test/CodeGen/uwtable-attr.c new file mode 100644 index 000000000000..7436db979b6b --- /dev/null +++ b/clang/test/CodeGen/uwtable-attr.c @@ -0,0 +1,30 @@ +// Test that function and modules attributes react on the command-line options, +// it does not state the current behaviour makes sense in all cases (it does not). + +// RUN: %clang -S -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,DEFAULT +// RUN: %clang -S -emit-llvm -o - %s -funwind-tables -fno-asynchronous-unwind-tables | FileCheck %s -check-prefixes=CHECK,TABLES +// RUN: %clang -S -emit-llvm -o - %s -fno-unwind-tables -fno-asynchronous-unwind-tables | FileCheck %s -check-prefixes=CHECK,NO_TABLES + +// RUN: %clang -S -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,DEFAULT +// RUN: %clang -S -emit-llvm -o - -x c++ %s -funwind-tables -fno-asynchronous-unwind-tables | FileCheck %s -check-prefixes=CHECK,TABLES +// RUN: %clang -S -emit-llvm -o - -x c++ %s -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables | FileCheck %s -check-prefixes=CHECK,NO_TABLES + +#ifdef __cplusplus +extern "C" void g(void); +struct S { ~S(); }; +extern "C" int f() { S s; g(); return 0;}; +#else +void g(void); +int f() { g(); return 0; }; +#endif + +// CHECK: define {{.*}} @f() #[[#F:]] +// CHECK: declare {{.*}} @g() #[[#]] + +// DEFAULT: attributes #[[#F]] = { {{.*}} uwtable{{ }}{{.*}} } +// DEFAULT: ![[#]] = !{i32 7, !"uwtable", i32 2} + +// TABLES: attributes #[[#F]] = { {{.*}} uwtable(sync){{.*}} } +// TABLES: ![[#]] = !{i32 7, !"uwtable", i32 1} + +// NO_TABLES-NOT: uwtable |