xref: /minix3/external/bsd/llvm/dist/clang/test/CXX/except/except.spec/p14-ir.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -o - %s | FileCheck %s
2f4a2713aSLionel Sambuc 
3f4a2713aSLionel Sambuc // Copy constructor
4f4a2713aSLionel Sambuc struct X0 {
5f4a2713aSLionel Sambuc   X0();
6f4a2713aSLionel Sambuc   X0(const X0 &) throw();
7f4a2713aSLionel Sambuc   X0(X0 &);
8f4a2713aSLionel Sambuc };
9f4a2713aSLionel Sambuc 
10f4a2713aSLionel Sambuc struct X1 {
11f4a2713aSLionel Sambuc   X1();
12f4a2713aSLionel Sambuc   X1(const X1 &) throw();
13f4a2713aSLionel Sambuc };
14f4a2713aSLionel Sambuc 
15f4a2713aSLionel Sambuc struct X2 : X1 {
16f4a2713aSLionel Sambuc   X2();
17f4a2713aSLionel Sambuc };
18f4a2713aSLionel Sambuc struct X3 : X0, X1 {
19f4a2713aSLionel Sambuc   X3();
20f4a2713aSLionel Sambuc };
21f4a2713aSLionel Sambuc 
22f4a2713aSLionel Sambuc struct X4 {
23f4a2713aSLionel Sambuc   X4(X4 &) throw();
24f4a2713aSLionel Sambuc };
25f4a2713aSLionel Sambuc 
26f4a2713aSLionel Sambuc struct X5 : X0, X4 { };
27f4a2713aSLionel Sambuc 
test(X2 x2,X3 x3,X5 x5)28f4a2713aSLionel Sambuc void test(X2 x2, X3 x3, X5 x5) {
29*0a6a1f1dSLionel Sambuc   // CHECK: define linkonce_odr void @_ZN2X2C1ERKS_(%struct.X2* %this, %struct.X2* dereferenceable({{[0-9]+}})) unnamed_addr
30f4a2713aSLionel Sambuc   // CHECK:      call void @_ZN2X2C2ERKS_({{.*}}) [[NUW:#[0-9]+]]
31f4a2713aSLionel Sambuc   // CHECK-NEXT: ret void
32f4a2713aSLionel Sambuc   // CHECK-NEXT: }
33f4a2713aSLionel Sambuc   X2 x2a(x2);
34*0a6a1f1dSLionel Sambuc   // CHECK: define linkonce_odr void @_ZN2X3C1ERKS_(%struct.X3* %this, %struct.X3* dereferenceable({{[0-9]+}})) unnamed_addr
35f4a2713aSLionel Sambuc   // CHECK:      call void @_ZN2X3C2ERKS_({{.*}}) [[NUW]]
36f4a2713aSLionel Sambuc   // CHECK-NEXT: ret void
37f4a2713aSLionel Sambuc   // CHECK-NEXT: }
38f4a2713aSLionel Sambuc   X3 x3a(x3);
39f4a2713aSLionel Sambuc   // CHECK: define linkonce_odr void @_ZN2X5C1ERS_({{.*}}) unnamed_addr
40f4a2713aSLionel Sambuc   // CHECK-NOT: call void @__cxa_call_unexpected
41f4a2713aSLionel Sambuc   // CHECK: ret void
42f4a2713aSLionel Sambuc   X5 x5a(x5);
43f4a2713aSLionel Sambuc }
44f4a2713aSLionel Sambuc 
45f4a2713aSLionel Sambuc // Default constructor
46f4a2713aSLionel Sambuc struct X6 {
47f4a2713aSLionel Sambuc   X6() throw();
48f4a2713aSLionel Sambuc };
49f4a2713aSLionel Sambuc 
50f4a2713aSLionel Sambuc struct X7 {
51f4a2713aSLionel Sambuc   X7();
52f4a2713aSLionel Sambuc };
53f4a2713aSLionel Sambuc 
54f4a2713aSLionel Sambuc struct X8 : X6 { };
55f4a2713aSLionel Sambuc struct X9 : X6, X7 { };
56f4a2713aSLionel Sambuc 
test()57f4a2713aSLionel Sambuc void test() {
58f4a2713aSLionel Sambuc   // CHECK: define linkonce_odr void @_ZN2X8C1Ev(%struct.X8* %this) unnamed_addr
59f4a2713aSLionel Sambuc   // CHECK:      call void @_ZN2X8C2Ev({{.*}}) [[NUW]]
60f4a2713aSLionel Sambuc   // CHECK-NEXT: ret void
61f4a2713aSLionel Sambuc   X8();
62f4a2713aSLionel Sambuc 
63f4a2713aSLionel Sambuc   // CHECK: define linkonce_odr void @_ZN2X9C1Ev(%struct.X9* %this) unnamed_addr
64f4a2713aSLionel Sambuc   //   FIXME: check that this is the end of the line here:
65f4a2713aSLionel Sambuc   // CHECK:      call void @_ZN2X9C2Ev({{.*}})
66f4a2713aSLionel Sambuc   // CHECK-NEXT: ret void
67f4a2713aSLionel Sambuc   X9();
68f4a2713aSLionel Sambuc 
69f4a2713aSLionel Sambuc   // CHECK: define linkonce_odr void @_ZN2X9C2Ev(%struct.X9* %this) unnamed_addr
70f4a2713aSLionel Sambuc   // CHECK:      call void @_ZN2X6C2Ev({{.*}}) [[NUW]]
71f4a2713aSLionel Sambuc   //   FIXME: and here:
72f4a2713aSLionel Sambuc   // CHECK-NEXT: bitcast
73f4a2713aSLionel Sambuc   // CHECK-NEXT: call void @_ZN2X7C2Ev({{.*}})
74f4a2713aSLionel Sambuc   // CHECK: ret void
75f4a2713aSLionel Sambuc 
76f4a2713aSLionel Sambuc   // CHECK: define linkonce_odr void @_ZN2X8C2Ev(%struct.X8* %this) unnamed_addr
77f4a2713aSLionel Sambuc   // CHECK:      call void @_ZN2X6C2Ev({{.*}}) [[NUW]]
78f4a2713aSLionel Sambuc   // CHECK-NEXT: ret void
79f4a2713aSLionel Sambuc }
80f4a2713aSLionel Sambuc 
81f4a2713aSLionel Sambuc // CHECK: attributes [[NUW]] = { nounwind{{.*}} }
82