]> granicus.if.org Git - clang/commitdiff
Output destructors and constructors in a more natural order.
authorRafael Espindola <rafael.espindola@gmail.com>
Mon, 9 Dec 2013 14:51:17 +0000 (14:51 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Mon, 9 Dec 2013 14:51:17 +0000 (14:51 +0000)
With this patch we output the in the order
C2
C1

D2
D1
D0

Which means that a destructor or constructor that call another is output after
the callee. This is a bit easier to read IHMO and a tiny bit more efficient
as we don't put a decl in DeferredDeclsToEmit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196784 91177308-0d34-0410-b5e6-96231b3b80d8

18 files changed:
lib/CodeGen/ItaniumCXXABI.cpp
test/CodeGenCXX/abstract-class-ctors-dtors.cpp
test/CodeGenCXX/block-in-ctor-dtor.cpp
test/CodeGenCXX/constructor-destructor-return-this.cpp
test/CodeGenCXX/constructors.cpp
test/CodeGenCXX/cxx0x-defaulted-templates.cpp
test/CodeGenCXX/cxx0x-delegating-ctors.cpp
test/CodeGenCXX/default-arguments.cpp
test/CodeGenCXX/destructors.cpp
test/CodeGenCXX/eh.cpp
test/CodeGenCXX/inheriting-constructor.cpp
test/CodeGenCXX/mangle-subst-std.cpp
test/CodeGenCXX/mangle.cpp
test/CodeGenCXX/member-templates.cpp
test/CodeGenCXX/pr13396.cpp
test/CodeGenCXX/static-init.cpp
test/CodeGenCXX/virtual-bases.cpp
test/CodeGenCXX/virtual-destructor-calls.cpp

index 0e8f31a48454a122fa454231599529ba76aa978a..200a8fd2d302ab786502c2838f50dd867b58c6d4 100644 (file)
@@ -815,16 +815,16 @@ void ItaniumCXXABI::EmitCXXConstructors(const CXXConstructorDecl *D) {
   // Just make sure we're in sync with TargetCXXABI.
   assert(CGM.getTarget().getCXXABI().hasConstructorVariants());
 
+  // The constructor used for constructing this as a base class;
+  // ignores virtual bases.
+  CGM.EmitGlobal(GlobalDecl(D, Ctor_Base));
+
   // The constructor used for constructing this as a complete class;
   // constucts the virtual bases, then calls the base constructor.
   if (!D->getParent()->isAbstract()) {
     // We don't need to emit the complete ctor if the class is abstract.
     CGM.EmitGlobal(GlobalDecl(D, Ctor_Complete));
   }
-
-  // The constructor used for constructing this as a base class;
-  // ignores virtual bases.
-  CGM.EmitGlobal(GlobalDecl(D, Ctor_Base));
 }
 
 /// The generic ABI passes 'this', plus a VTT if it's destroying a
@@ -844,19 +844,19 @@ void ItaniumCXXABI::BuildDestructorSignature(const CXXDestructorDecl *Dtor,
 }
 
 void ItaniumCXXABI::EmitCXXDestructors(const CXXDestructorDecl *D) {
-  // The destructor in a virtual table is always a 'deleting'
-  // destructor, which calls the complete destructor and then uses the
-  // appropriate operator delete.
-  if (D->isVirtual())
-    CGM.EmitGlobal(GlobalDecl(D, Dtor_Deleting));
+  // The destructor used for destructing this as a base class; ignores
+  // virtual bases.
+  CGM.EmitGlobal(GlobalDecl(D, Dtor_Base));
 
   // The destructor used for destructing this as a most-derived class;
   // call the base destructor and then destructs any virtual bases.
   CGM.EmitGlobal(GlobalDecl(D, Dtor_Complete));
 
-  // The destructor used for destructing this as a base class; ignores
-  // virtual bases.
-  CGM.EmitGlobal(GlobalDecl(D, Dtor_Base));
+  // The destructor in a virtual table is always a 'deleting'
+  // destructor, which calls the complete destructor and then uses the
+  // appropriate operator delete.
+  if (D->isVirtual())
+    CGM.EmitGlobal(GlobalDecl(D, Dtor_Deleting));
 }
 
 void ItaniumCXXABI::BuildInstanceFunctionParams(CodeGenFunction &CGF,
index 793bbde050212c1559876a103ec08c49cbb9b55e..a159a287cbed63d863407cdda600e7aac3d95454 100644 (file)
@@ -9,8 +9,8 @@ struct A {
 
 // CHECK-NOT-LABEL: define void @_ZN1AC1Ev
 // CHECK-LABEL: define void @_ZN1AC2Ev
-// CHECK-LABEL: define void @_ZN1AD1Ev
 // CHECK-LABEL: define void @_ZN1AD2Ev
+// CHECK-LABEL: define void @_ZN1AD1Ev
 A::A() { }
 
 A::~A() { }
index bd37d4418d4f07204b3f9660e5055c95dabb4fd2..0dc0ab00437faef42149a11bd2a67f27022a4af4 100644 (file)
@@ -40,9 +40,9 @@ X::~X() {
 // CHECK-LABEL: define internal void @___ZN4ZoneC2Ev_block_invoke_
 // CHECK-LABEL: define internal void @___ZN4ZoneD2Ev_block_invoke
 // CHECK-LABEL: define internal void @___ZN4ZoneD2Ev_block_invoke_
-// CHECK-LABEL: define internal void @___ZN1XC1Ev_block_invoke
-// CHECK-LABEL: define internal void @___ZN1XC1Ev_block_invoke_
 // CHECK-LABEL: define internal void @___ZN1XC2Ev_block_invoke
 // CHECK-LABEL: define internal void @___ZN1XC2Ev_block_invoke_
+// CHECK-LABEL: define internal void @___ZN1XC1Ev_block_invoke
+// CHECK-LABEL: define internal void @___ZN1XC1Ev_block_invoke_
 // CHECK-LABEL: define internal void @___ZN1XD2Ev_block_invoke
 // CHECK-LABEL: define internal void @___ZN1XD2Ev_block_invoke_
index ea2ea45a3273e451cf75fc97c88a8aac339e7c16..e395620746d597cb4206d484e85fb75c0acc3df1 100644 (file)
@@ -27,15 +27,15 @@ private:
 B::B(int *i) : i_(i) { }
 B::~B() { }
 
-// CHECKGEN-LABEL: define void @_ZN1BC1EPi(%class.B* %this, i32* %i)
 // CHECKGEN-LABEL: define void @_ZN1BC2EPi(%class.B* %this, i32* %i)
-// CHECKGEN-LABEL: define void @_ZN1BD1Ev(%class.B* %this)
+// CHECKGEN-LABEL: define void @_ZN1BC1EPi(%class.B* %this, i32* %i)
 // CHECKGEN-LABEL: define void @_ZN1BD2Ev(%class.B* %this)
+// CHECKGEN-LABEL: define void @_ZN1BD1Ev(%class.B* %this)
 
-// CHECKARM-LABEL: define %class.B* @_ZN1BC1EPi(%class.B* returned %this, i32* %i)
 // CHECKARM-LABEL: define %class.B* @_ZN1BC2EPi(%class.B* returned %this, i32* %i)
-// CHECKARM-LABEL: define %class.B* @_ZN1BD1Ev(%class.B* returned %this)
+// CHECKARM-LABEL: define %class.B* @_ZN1BC1EPi(%class.B* returned %this, i32* %i)
 // CHECKARM-LABEL: define %class.B* @_ZN1BD2Ev(%class.B* returned %this)
+// CHECKARM-LABEL: define %class.B* @_ZN1BD1Ev(%class.B* returned %this)
 
 // CHECKMS-LABEL: define x86_thiscallcc %class.B* @"\01??0B@@QAE@PAH@Z"(%class.B* returned %this, i32* %i)
 // CHECKMS-LABEL: define x86_thiscallcc void @"\01??1B@@QAE@XZ"(%class.B* %this)
@@ -51,17 +51,17 @@ private:
 C::C(int *i, char *c) : B(i), c_(c) { }
 C::~C() { }
 
-// CHECKGEN-LABEL: define void @_ZN1CC1EPiPc(%class.C* %this, i32* %i, i8* %c)
 // CHECKGEN-LABEL: define void @_ZN1CC2EPiPc(%class.C* %this, i32* %i, i8* %c)
-// CHECKGEN-LABEL: define void @_ZN1CD0Ev(%class.C* %this)
-// CHECKGEN-LABEL: define void @_ZN1CD1Ev(%class.C* %this)
+// CHECKGEN-LABEL: define void @_ZN1CC1EPiPc(%class.C* %this, i32* %i, i8* %c)
 // CHECKGEN-LABEL: define void @_ZN1CD2Ev(%class.C* %this)
+// CHECKGEN-LABEL: define void @_ZN1CD1Ev(%class.C* %this)
+// CHECKGEN-LABEL: define void @_ZN1CD0Ev(%class.C* %this)
 
-// CHECKARM-LABEL: define %class.C* @_ZN1CC1EPiPc(%class.C* returned %this, i32* %i, i8* %c)
 // CHECKARM-LABEL: define %class.C* @_ZN1CC2EPiPc(%class.C* returned %this, i32* %i, i8* %c)
-// CHECKARM-LABEL: define void @_ZN1CD0Ev(%class.C* %this)
-// CHECKARM-LABEL: define %class.C* @_ZN1CD1Ev(%class.C* returned %this)
+// CHECKARM-LABEL: define %class.C* @_ZN1CC1EPiPc(%class.C* returned %this, i32* %i, i8* %c)
 // CHECKARM-LABEL: define %class.C* @_ZN1CD2Ev(%class.C* returned %this)
+// CHECKARM-LABEL: define %class.C* @_ZN1CD1Ev(%class.C* returned %this)
+// CHECKARM-LABEL: define void @_ZN1CD0Ev(%class.C* %this)
 
 // CHECKMS-LABEL: define x86_thiscallcc %class.C* @"\01??0C@@QAE@PAHPAD@Z"(%class.C* returned %this, i32* %i, i8* %c)
 // CHECKMS-LABEL: define x86_thiscallcc void @"\01??1C@@UAE@XZ"(%class.C* %this)
@@ -75,15 +75,16 @@ public:
 D::D() { }
 D::~D() { }
 
-// CHECKGEN-LABEL: define void @_ZN1DC1Ev(%class.D* %this)
 // CHECKGEN-LABEL: define void @_ZN1DC2Ev(%class.D* %this, i8** %vtt)
-// CHECKGEN-LABEL: define void @_ZN1DD1Ev(%class.D* %this)
+// CHECKGEN-LABEL: define void @_ZN1DC1Ev(%class.D* %this)
 // CHECKGEN-LABEL: define void @_ZN1DD2Ev(%class.D* %this, i8** %vtt)
+// CHECKGEN-LABEL: define void @_ZN1DD1Ev(%class.D* %this)
 
-// CHECKARM-LABEL: define %class.D* @_ZN1DC1Ev(%class.D* returned %this)
 // CHECKARM-LABEL: define %class.D* @_ZN1DC2Ev(%class.D* returned %this, i8** %vtt)
-// CHECKARM-LABEL: define %class.D* @_ZN1DD1Ev(%class.D* returned %this)
+// CHECKARM-LABEL: define %class.D* @_ZN1DC1Ev(%class.D* returned %this)
 // CHECKARM-LABEL: define %class.D* @_ZN1DD2Ev(%class.D* returned %this, i8** %vtt)
+// CHECKARM-LABEL: define %class.D* @_ZN1DD1Ev(%class.D* returned %this)
+
 
 // CHECKMS-LABEL: define x86_thiscallcc %class.D* @"\01??0D@@QAE@XZ"(%class.D* returned %this, i32 %is_most_derived)
 // CHECKMS-LABEL: define x86_thiscallcc void @"\01??1D@@QAE@XZ"(%class.D* %this)
index f730b9ef491a947723458f83264fd1903c43dd88..02c28c7e3e05a3988fd2a9378baaeb30dc224f3f 100644 (file)
@@ -21,20 +21,19 @@ struct A {
 A::A(struct Undeclared &ref) : mem(0) {}
 
 // Check that delegation works.
-// CHECK-LABEL: define void @_ZN1AC1ER10Undeclared(%struct.A* %this, %struct.Undeclared* %ref) unnamed_addr
-// CHECK: call void @_ZN1AC2ER10Undeclared(
-
 // CHECK-LABEL: define void @_ZN1AC2ER10Undeclared(%struct.A* %this, %struct.Undeclared* %ref) unnamed_addr
 // CHECK: call void @_ZN6MemberC1Ei(
 
-A::A(ValueClass v) : mem(v.y - v.x) {}
+// CHECK-LABEL: define void @_ZN1AC1ER10Undeclared(%struct.A* %this, %struct.Undeclared* %ref) unnamed_addr
+// CHECK: call void @_ZN1AC2ER10Undeclared(
 
-// CHECK-LABEL: define void @_ZN1AC1E10ValueClass(%struct.A* %this, i64 %v.coerce) unnamed_addr
-// CHECK: call void @_ZN1AC2E10ValueClass(
+A::A(ValueClass v) : mem(v.y - v.x) {}
 
 // CHECK-LABEL: define void @_ZN1AC2E10ValueClass(%struct.A* %this, i64 %v.coerce) unnamed_addr
 // CHECK: call void @_ZN6MemberC1Ei(
 
+// CHECK-LABEL: define void @_ZN1AC1E10ValueClass(%struct.A* %this, i64 %v.coerce) unnamed_addr
+// CHECK: call void @_ZN1AC2E10ValueClass(
 
 /* Test that things work for inheritance. */
 struct B : A {
@@ -44,13 +43,12 @@ struct B : A {
 
 B::B(struct Undeclared &ref) : A(ref), mem(1) {}
 
-// CHECK-LABEL: define void @_ZN1BC1ER10Undeclared(%struct.B* %this, %struct.Undeclared* %ref) unnamed_addr
-// CHECK: call void @_ZN1BC2ER10Undeclared(
-
 // CHECK-LABEL: define void @_ZN1BC2ER10Undeclared(%struct.B* %this, %struct.Undeclared* %ref) unnamed_addr
 // CHECK: call void @_ZN1AC2ER10Undeclared(
 // CHECK: call void @_ZN6MemberC1Ei(
 
+// CHECK-LABEL: define void @_ZN1BC1ER10Undeclared(%struct.B* %this, %struct.Undeclared* %ref) unnamed_addr
+// CHECK: call void @_ZN1BC2ER10Undeclared(
 
 
 /* Test that the delegation optimization is disabled for classes with
@@ -64,15 +62,14 @@ struct C : virtual A {
 };
 C::C(int x) : A(ValueClass(x, x+1)), mem(x * x) {}
 
+// CHECK-LABEL: define void @_ZN1CC2Ei(%struct.C* %this, i8** %vtt, i32 %x) unnamed_addr
+// CHECK: call void @_ZN6MemberC1Ei(
+
 // CHECK-LABEL: define void @_ZN1CC1Ei(%struct.C* %this, i32 %x) unnamed_addr
 // CHECK: call void @_ZN10ValueClassC1Eii(
 // CHECK: call void @_ZN1AC2E10ValueClass(
 // CHECK: call void @_ZN6MemberC1Ei(
 
-// CHECK-LABEL: define void @_ZN1CC2Ei(%struct.C* %this, i8** %vtt, i32 %x) unnamed_addr
-// CHECK: call void @_ZN6MemberC1Ei(
-
-
 
 /* Test that the delegation optimization is disabled for varargs
    constructors. */
@@ -83,17 +80,16 @@ struct D : A {
 
 D::D(int x, ...) : A(ValueClass(x, x+1)), mem(x*x) {}
 
-// CHECK-LABEL: define void @_ZN1DC1Eiz(%struct.D* %this, i32 %x, ...) unnamed_addr
+// CHECK-LABEL: define void @_ZN1DC2Eiz(%struct.D* %this, i32 %x, ...) unnamed_addr
 // CHECK: call void @_ZN10ValueClassC1Eii(
 // CHECK: call void @_ZN1AC2E10ValueClass(
 // CHECK: call void @_ZN6MemberC1Ei(
 
-// CHECK-LABEL: define void @_ZN1DC2Eiz(%struct.D* %this, i32 %x, ...) unnamed_addr
+// CHECK-LABEL: define void @_ZN1DC1Eiz(%struct.D* %this, i32 %x, ...) unnamed_addr
 // CHECK: call void @_ZN10ValueClassC1Eii(
 // CHECK: call void @_ZN1AC2E10ValueClass(
 // CHECK: call void @_ZN6MemberC1Ei(
 
-
 // PR6622:  this shouldn't crash
 namespace test0 {
   struct A {};
index f4d5ccc0e3319bf1b4de6cb67475427763262eac..92fbfff8abf3254e410818564d2009f6ce01841e 100644 (file)
@@ -5,12 +5,12 @@ struct X {
   X();
 };
 
-// CHECK: define {{.*}} @_ZN1XIbEC1Ev
 // CHECK: define {{.*}} @_ZN1XIbEC2Ev
+// CHECK: define {{.*}} @_ZN1XIbEC1Ev
 template <> X<bool>::X() = default;
 
-// CHECK: define weak_odr {{.*}} @_ZN1XIiEC1Ev
 // CHECK: define weak_odr {{.*}} @_ZN1XIiEC2Ev
+// CHECK: define weak_odr {{.*}} @_ZN1XIiEC1Ev
 template <typename T> X<T>::X() = default;
 template X<int>::X();
 
index c48e61fd14e03c29342891d7e2411ae7f38bf891..dcc055696e4dd5fe769b150b866abe6dfdfb7cf9 100644 (file)
@@ -26,28 +26,30 @@ delegator::delegator() {
 delegator::delegator(bool)
 {}
 
-// CHECK: define {{.*}} @_ZN9delegatorC1Ec
-// CHECK: {{.*}} @_ZN9delegatorC1Eb
-// CHECK: void @__cxa_throw
-// CHECK: void @__clang_call_terminate
-// CHECK: {{.*}} @_ZN9delegatorD1Ev
-// CHECK: define {{.*}} @_ZN9delegatorC2Ec
+// CHECK-LABEL: define {{.*}} @_ZN9delegatorC2Ec
 // CHECK: {{.*}} @_ZN9delegatorC2Eb
 // CHECK: void @__cxa_throw
 // CHECK: void @__clang_call_terminate
 // CHECK: {{.*}} @_ZN9delegatorD2Ev
+
+// CHECK-LABEL: define {{.*}} @_ZN9delegatorC1Ec
+// CHECK: {{.*}} @_ZN9delegatorC1Eb
+// CHECK: void @__cxa_throw
+// CHECK: void @__clang_call_terminate
+// CHECK: {{.*}} @_ZN9delegatorD1Ev
 delegator::delegator(char)
   : delegator(true) {
   throw 0;
 }
 
-// CHECK: define {{.*}} @_ZN9delegatorC1Ei
-// CHECK: {{.*}} @_ZN9delegatorC1Ev
+// CHECK-LABEL: define {{.*}} @_ZN9delegatorC2Ei
+// CHECK: {{.*}} @_ZN9delegatorC2Ev
 // CHECK-NOT: void @_ZSt9terminatev
 // CHECK: ret
 // CHECK-NOT: void @_ZSt9terminatev
-// CHECK: define {{.*}} @_ZN9delegatorC2Ei
-// CHECK: {{.*}} @_ZN9delegatorC2Ev
+
+// CHECK-LABEL: define {{.*}} @_ZN9delegatorC1Ei
+// CHECK: {{.*}} @_ZN9delegatorC1Ev
 // CHECK-NOT: void @_ZSt9terminatev
 // CHECK: ret
 // CHECK-NOT: void @_ZSt9terminatev
index 83cae3afd5615967ed28e4c0319d50839e42e055..d364835850c3cea6d6ef70b3806841d553ceb5c2 100644 (file)
@@ -42,15 +42,15 @@ struct C {
  C();
 };
 
-// CHECK-LABEL: define void @_ZN1CC1Ev(%struct.C* %this) unnamed_addr
-// CHECK: call void @_ZN1CC2Ev(
-
 // CHECK-LABEL: define void @_ZN1CC2Ev(%struct.C* %this) unnamed_addr
 // CHECK: call void @_ZN2A1C1Ev(
 // CHECK: call void @_ZN2A2C1Ev(
 // CHECK: call void @_ZN1BC1ERK2A1RK2A2(
 // CHECK: call void @_ZN2A2D1Ev
 // CHECK: call void @_ZN2A1D1Ev
+
+// CHECK-LABEL: define void @_ZN1CC1Ev(%struct.C* %this) unnamed_addr
+// CHECK: call void @_ZN1CC2Ev(
 C::C() { }
 
 // CHECK-LABEL: define void @_Z2f3v()
index 799cca28b4a4e38da66b80490ef1d88bbd65e6fd..f0e5a124eee6938a73c5bba994daafe19aa0135f 100644 (file)
@@ -102,19 +102,19 @@ namespace test0 {
   B::~B() try { } catch (int i) {}
   // It will suppress the delegation optimization here, though.
 
-// CHECK-LABEL: define void @_ZN5test01BD1Ev(%"struct.test0::B"* %this) unnamed_addr
+// CHECK-LABEL: define void @_ZN5test01BD2Ev(%"struct.test0::B"* %this, i8** %vtt) unnamed_addr
 // CHECK: invoke void @_ZN5test06MemberD1Ev
 // CHECK:   unwind label [[MEM_UNWIND:%[a-zA-Z0-9.]+]]
 // CHECK: invoke void @_ZN5test04BaseD2Ev
 // CHECK:   unwind label [[BASE_UNWIND:%[a-zA-Z0-9.]+]]
-// CHECK: invoke void @_ZN5test05VBaseD2Ev
-// CHECK:   unwind label [[VBASE_UNWIND:%[a-zA-Z0-9.]+]]
 
-// CHECK-LABEL: define void @_ZN5test01BD2Ev(%"struct.test0::B"* %this, i8** %vtt) unnamed_addr
+// CHECK-LABEL: define void @_ZN5test01BD1Ev(%"struct.test0::B"* %this) unnamed_addr
 // CHECK: invoke void @_ZN5test06MemberD1Ev
 // CHECK:   unwind label [[MEM_UNWIND:%[a-zA-Z0-9.]+]]
 // CHECK: invoke void @_ZN5test04BaseD2Ev
 // CHECK:   unwind label [[BASE_UNWIND:%[a-zA-Z0-9.]+]]
+// CHECK: invoke void @_ZN5test05VBaseD2Ev
+// CHECK:   unwind label [[VBASE_UNWIND:%[a-zA-Z0-9.]+]]
 }
 
 // Test base-class aliasing.
@@ -272,14 +272,6 @@ namespace test6 {
   // FIXME: way too much EH cleanup code follows
 
   C::~C() { opaque(); }
-  // CHECK-LABEL: define void @_ZN5test61CD1Ev(%"struct.test6::C"* %this) unnamed_addr
-  // CHECK:   invoke void @_ZN5test61CD2Ev
-  // CHECK:   invoke void @_ZN5test61BILj3EED2Ev
-  // CHECK:   call void @_ZN5test61BILj2EED2Ev
-  // CHECK:   ret void
-  // CHECK:   invoke void @_ZN5test61BILj3EED2Ev
-  // CHECK:   invoke void @_ZN5test61BILj2EED2Ev
-
   // CHECK-LABEL: define void @_ZN5test61CD2Ev(%"struct.test6::C"* %this, i8** %vtt) unnamed_addr
   // CHECK:   invoke void @_ZN5test66opaqueEv
   // CHECK:   invoke void @_ZN5test61AD1Ev
@@ -293,6 +285,14 @@ namespace test6 {
   // CHECK:   invoke void @_ZN5test61AD1Ev
   // CHECK:   invoke void @_ZN5test61BILj1EED2Ev
   // CHECK:   invoke void @_ZN5test61BILj0EED2Ev
+
+  // CHECK-LABEL: define void @_ZN5test61CD1Ev(%"struct.test6::C"* %this) unnamed_addr
+  // CHECK:   invoke void @_ZN5test61CD2Ev
+  // CHECK:   invoke void @_ZN5test61BILj3EED2Ev
+  // CHECK:   call void @_ZN5test61BILj2EED2Ev
+  // CHECK:   ret void
+  // CHECK:   invoke void @_ZN5test61BILj3EED2Ev
+  // CHECK:   invoke void @_ZN5test61BILj2EED2Ev
 }
 
 // PR 9197
index 2a61e61bb8184bfcc62048de505761ad2360afcf..c4ec9dd5dec978c3e08c0c27d07b2fbbf53d1621 100644 (file)
@@ -184,9 +184,6 @@ namespace test9 {
 
   struct A { A(); };
 
-  // CHECK-LABEL:      define void @_ZN5test91AC1Ev(%"struct.test9::A"* %this) unnamed_addr
-  // CHECK:      call void @_ZN5test91AC2Ev
-  // CHECK-NEXT: ret void
 
   // CHECK-LABEL: define void @_ZN5test91AC2Ev(%"struct.test9::A"* %this) unnamed_addr
   A::A() try {
@@ -199,6 +196,10 @@ namespace test9 {
   // CHECK:      call i8* @__cxa_begin_catch
   // CHECK:      invoke void @_ZN5test96opaqueEv()
   // CHECK:      invoke void @__cxa_rethrow()
+
+  // CHECK-LABEL:      define void @_ZN5test91AC1Ev(%"struct.test9::A"* %this) unnamed_addr
+  // CHECK:      call void @_ZN5test91AC2Ev
+  // CHECK-NEXT: ret void
     opaque();
   }
 }
index c99a20c730e4222f31976a12f62831d8a27d7562..9394137e64144b4d7935513e4cb5c5d138c40da5 100644 (file)
@@ -11,9 +11,9 @@ struct C { template<typename T> C(T); };
 struct D : C { using C::C; };
 D d(123);
 
-// CHECK-LABEL: define void @_ZN1BD0Ev
-// CHECK-LABEL: define void @_ZN1BD1Ev
 // CHECK-LABEL: define void @_ZN1BD2Ev
+// CHECK-LABEL: define void @_ZN1BD1Ev
+// CHECK-LABEL: define void @_ZN1BD0Ev
 
 // CHECK-LABEL: define linkonce_odr void @_ZN1BC1Ei(
 // CHECK: call void @_ZN1BC2Ei(
index 6277c7af21c478589989a61a87ea063fa4a2fc21..678956e11182a93cc18e6ab24b30cd46cdeb3dfe 100644 (file)
@@ -15,8 +15,8 @@
 namespace std {
   struct A { A(); };
   
-  // CHECK-LABEL: define void @_ZNSt1AC1Ev(%"struct.std::A"* %this) unnamed_addr
   // CHECK-LABEL: define void @_ZNSt1AC2Ev(%"struct.std::A"* %this) unnamed_addr
+  // CHECK-LABEL: define void @_ZNSt1AC1Ev(%"struct.std::A"* %this) unnamed_addr
   A::A() { }
 };
 
index d836f36c1818baf0007daead96bd597c2195bb0c..ffb66361fcba3ac5aa6b3b455b7e18cdce1a4699 100644 (file)
@@ -216,9 +216,9 @@ struct S7 {
 };
 
 // PR5139
-// CHECK: @_ZN2S7C1Ev
 // CHECK: @_ZN2S7C2Ev
 // CHECK: @_ZN2S7Ut_C1Ev
+// CHECK: @_ZN2S7C1Ev
 S7::S7() {}
 
 // PR5063
index c72dd6e5f5289e2805defdceafe7777c0d08968a..93d36ff4750ac22e04cb1b0ed677003812521f2f 100644 (file)
@@ -15,8 +15,8 @@ struct B {
 
 template<typename T> B::B(T) {}
 
-// CHECK-LABEL: define weak_odr void @_ZN1BC1IiEET_(%struct.B* %this, i32) unnamed_addr
 // CHECK-LABEL: define weak_odr void @_ZN1BC2IiEET_(%struct.B* %this, i32) unnamed_addr
+// CHECK-LABEL: define weak_odr void @_ZN1BC1IiEET_(%struct.B* %this, i32) unnamed_addr
 template B::B(int);
 
 template<typename T>
index 3d582c51006b47d3483985cee6cf02842a3cc7d9..e41dd39fcc6e7095bfb12d8ec0c65ff02cd3966a 100644 (file)
@@ -7,13 +7,13 @@ struct foo {
 };
 
 foo::foo() {
-  // CHECK-LABEL: define void @_ZN3fooC1Ev(%struct.foo* inreg %this)
   // CHECK-LABEL: define void @_ZN3fooC2Ev(%struct.foo* inreg %this)
+  // CHECK-LABEL: define void @_ZN3fooC1Ev(%struct.foo* inreg %this)
 }
 
 foo::~foo() {
-  // CHECK-LABEL: define void @_ZN3fooD1Ev(%struct.foo* inreg %this)
   // CHECK-LABEL: define void @_ZN3fooD2Ev(%struct.foo* inreg %this)
+  // CHECK-LABEL: define void @_ZN3fooD1Ev(%struct.foo* inreg %this)
 }
 
 void dummy() {
index f522775c109efe3563d97eaabe308735e7d2cb5b..d23ead47f385570beecc5fcad142805ca5bbc609 100644 (file)
@@ -103,14 +103,14 @@ namespace test2 {
   B::B() {
     static int x = foo();
   }
-  // CHECK-LABEL: define void @_ZN5test21BC1Ev
+  // CHECK-LABEL: define void @_ZN5test21BC2Ev
   // CHECK:   load atomic i8* bitcast (i64* @_ZGVZN5test21BC1EvE1x to i8*) acquire,
   // CHECK:   call i32 @__cxa_guard_acquire(i64* @_ZGVZN5test21BC1EvE1x)
   // CHECK:   [[T0:%.*]] = call i32 @_ZN5test23fooEv()
   // CHECK:   store i32 [[T0]], i32* @_ZZN5test21BC1EvE1x,
   // CHECK:   call void @__cxa_guard_release(i64* @_ZGVZN5test21BC1EvE1x)
 
-  // CHECK-LABEL: define void @_ZN5test21BC2Ev
+  // CHECK-LABEL: define void @_ZN5test21BC1Ev
   // CHECK:   load atomic i8* bitcast (i64* @_ZGVZN5test21BC1EvE1x to i8*) acquire,
   // CHECK:   call i32 @__cxa_guard_acquire(i64* @_ZGVZN5test21BC1EvE1x)
   // CHECK:   [[T0:%.*]] = call i32 @_ZN5test23fooEv()
@@ -122,15 +122,15 @@ namespace test2 {
   B::~B() {
     static int y = foo();
   }
-  // CHECK-LABEL: define void @_ZN5test21BD1Ev(
-  // CHECK:   call void @_ZN5test21BD2Ev(
-
   // CHECK-LABEL: define void @_ZN5test21BD2Ev(
   // CHECK:   load atomic i8* bitcast (i64* @_ZGVZN5test21BD1EvE1y to i8*) acquire,
   // CHECK:   call i32 @__cxa_guard_acquire(i64* @_ZGVZN5test21BD1EvE1y)
   // CHECK:   [[T0:%.*]] = call i32 @_ZN5test23fooEv()
   // CHECK:   store i32 [[T0]], i32* @_ZZN5test21BD1EvE1y,
   // CHECK:   call void @__cxa_guard_release(i64* @_ZGVZN5test21BD1EvE1y)
+
+  // CHECK-LABEL: define void @_ZN5test21BD1Ev(
+  // CHECK:   call void @_ZN5test21BD2Ev(
 }
 
 // This shouldn't error out.
@@ -149,6 +149,6 @@ namespace test3 {
     union U { char x; int i; };
     static U u = { 'a' };
   }
-  // CHECK-LABEL: define void @_ZN5test31BC1Ev(
   // CHECK-LABEL: define void @_ZN5test31BC2Ev(
+  // CHECK-LABEL: define void @_ZN5test31BC1Ev(
 }
index 2878e95b52cdb94f550a729889bc35c56e871eab..e9c568c31b4880b9bb3deb2b35e8b24a68d2f8fc 100644 (file)
@@ -12,16 +12,16 @@ struct B : virtual A {
   B();
 };
 
-// CHECK-LABEL: define void @_ZN1BC1Ev(%struct.B* %this) unnamed_addr
 // CHECK-LABEL: define void @_ZN1BC2Ev(%struct.B* %this, i8** %vtt) unnamed_addr
+// CHECK-LABEL: define void @_ZN1BC1Ev(%struct.B* %this) unnamed_addr
 B::B() { }
 
 struct C : virtual A {
   C(bool);
 };
 
-// CHECK-LABEL: define void @_ZN1CC1Eb(%struct.C* %this, i1 zeroext) unnamed_addr
 // CHECK-LABEL: define void @_ZN1CC2Eb(%struct.C* %this, i8** %vtt, i1 zeroext) unnamed_addr
+// CHECK-LABEL: define void @_ZN1CC1Eb(%struct.C* %this, i1 zeroext) unnamed_addr
 C::C(bool) { }
 
 // PR6251
index ae3704f3692864d3f14015e0c9bfd3d67e1ea48c..3e7fa8293af81a0b7f54d0fb041ff78d000c4c58 100644 (file)
@@ -20,16 +20,16 @@ struct B : A {
 // CHECK: @_ZN1CD1Ev = alias {{.*}} @_ZN1CD2Ev
 // CHECK: @_ZN1CD2Ev = alias bitcast {{.*}} @_ZN1BD2Ev
 
-// Deleting dtor: defers to the complete dtor.
-// CHECK-LABEL: define void @_ZN1BD0Ev(%struct.B* %this) unnamed_addr
-// CHECK: call void @_ZN1BD1Ev
-// CHECK: call void @_ZdlPv
-
 // Base dtor: actually calls A's base dtor.
 // CHECK-LABEL: define void @_ZN1BD2Ev(%struct.B* %this) unnamed_addr
 // CHECK: call void @_ZN6MemberD1Ev
 // CHECK: call void @_ZN1AD2Ev
 
+// Deleting dtor: defers to the complete dtor.
+// CHECK-LABEL: define void @_ZN1BD0Ev(%struct.B* %this) unnamed_addr
+// CHECK: call void @_ZN1BD1Ev
+// CHECK: call void @_ZdlPv
+
 B::~B() { }
 
 struct C : B {