p14-ir.cpp 2.0 KB

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