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