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