xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/unwind-attr.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple i386-unknown-unknown -fexceptions -emit-llvm -o - %s | FileCheck %s
2*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -o - %s | FileCheck -check-prefix CHECK-NOEXC %s
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc int opaque();
5*f4a2713aSLionel Sambuc 
6*f4a2713aSLionel Sambuc // CHECK:       define [[INT:i.*]] @test0() [[TF:#[0-9]+]] {
7*f4a2713aSLionel Sambuc // CHECK-NOEXC: define [[INT:i.*]] @test0() [[NUW:#[0-9]+]] {
test0(void)8*f4a2713aSLionel Sambuc int test0(void) {
9*f4a2713aSLionel Sambuc   return opaque();
10*f4a2713aSLionel Sambuc }
11*f4a2713aSLionel Sambuc 
12*f4a2713aSLionel Sambuc // <rdar://problem/8087431>: locally infer nounwind at -O0
13*f4a2713aSLionel Sambuc // CHECK:       define [[INT:i.*]] @test1() [[NUW:#[0-9]+]] {
14*f4a2713aSLionel Sambuc // CHECK-NOEXC: define [[INT:i.*]] @test1() [[NUW]] {
test1(void)15*f4a2713aSLionel Sambuc int test1(void) {
16*f4a2713aSLionel Sambuc   return 0;
17*f4a2713aSLionel Sambuc }
18*f4a2713aSLionel Sambuc 
19*f4a2713aSLionel Sambuc // <rdar://problem/8283071>: not for weak functions
20*f4a2713aSLionel Sambuc // CHECK:       define weak [[INT:i.*]] @test2() [[TF]] {
21*f4a2713aSLionel Sambuc // CHECK-NOEXC: define weak [[INT:i.*]] @test2() [[NUW]] {
test2(void)22*f4a2713aSLionel Sambuc __attribute__((weak)) int test2(void) {
23*f4a2713aSLionel Sambuc   return 0;
24*f4a2713aSLionel Sambuc }
25*f4a2713aSLionel Sambuc 
26*f4a2713aSLionel Sambuc // CHECK: attributes [[TF]] = { "{{.*}} }
27*f4a2713aSLionel Sambuc // CHECK: attributes [[NUW]] = { nounwind{{.*}} }
28*f4a2713aSLionel Sambuc 
29*f4a2713aSLionel Sambuc // CHECK-NOEXC: attributes [[NUW]] = { nounwind{{.*}} }
30