2016-12-23 08:23:01 +08:00
|
|
|
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin10 -mconstructor-aliases -O1 -disable-llvm-passes | FileCheck %s
|
2009-12-05 03:33:17 +08:00
|
|
|
|
2010-02-23 08:48:20 +08:00
|
|
|
struct Member {
|
|
|
|
~Member();
|
|
|
|
};
|
|
|
|
|
2009-12-05 03:33:17 +08:00
|
|
|
struct A {
|
|
|
|
virtual ~A();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct B : A {
|
2010-02-23 08:48:20 +08:00
|
|
|
Member m;
|
2009-12-05 03:33:17 +08:00
|
|
|
virtual ~B();
|
|
|
|
};
|
|
|
|
|
2010-02-19 09:32:20 +08:00
|
|
|
// Complete dtor: just an alias because there are no virtual bases.
|
|
|
|
// CHECK: @_ZN1BD1Ev = alias {{.*}} @_ZN1BD2Ev
|
2010-01-02 09:01:18 +08:00
|
|
|
|
2010-02-23 08:48:20 +08:00
|
|
|
// (aliases from C)
|
2015-09-11 11:22:18 +08:00
|
|
|
// CHECK: @_ZN1CD2Ev = alias {{.*}}, bitcast {{.*}} @_ZN1BD2Ev
|
2014-09-16 23:18:21 +08:00
|
|
|
// CHECK: @_ZN1CD1Ev = alias {{.*}} @_ZN1CD2Ev
|
2010-02-23 08:48:20 +08:00
|
|
|
|
2010-02-19 03:59:28 +08:00
|
|
|
// Base dtor: actually calls A's base dtor.
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define void @_ZN1BD2Ev(%struct.B* %this) unnamed_addr
|
2010-02-23 08:48:20 +08:00
|
|
|
// CHECK: call void @_ZN6MemberD1Ev
|
2009-12-05 03:33:17 +08:00
|
|
|
// CHECK: call void @_ZN1AD2Ev
|
|
|
|
|
2013-12-09 22:51:17 +08:00
|
|
|
// 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
|
|
|
|
|
2009-12-05 03:33:17 +08:00
|
|
|
B::~B() { }
|
2010-02-23 08:48:20 +08:00
|
|
|
|
|
|
|
struct C : B {
|
|
|
|
~C();
|
|
|
|
};
|
|
|
|
|
|
|
|
C::~C() { }
|
|
|
|
|
|
|
|
// Complete dtor: just an alias (checked above).
|
|
|
|
|
|
|
|
// Deleting dtor: defers to the complete dtor.
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define void @_ZN1CD0Ev(%struct.C* %this) unnamed_addr
|
2010-02-23 08:48:20 +08:00
|
|
|
// CHECK: call void @_ZN1CD1Ev
|
|
|
|
// CHECK: call void @_ZdlPv
|
|
|
|
|
|
|
|
// Base dtor: just an alias to B's base dtor.
|
2012-05-15 14:15:11 +08:00
|
|
|
|
|
|
|
namespace PR12798 {
|
|
|
|
// A qualified call to a base class destructor should not undergo virtual
|
|
|
|
// dispatch. Template instantiation used to lose the qualifier.
|
|
|
|
struct A { virtual ~A(); };
|
|
|
|
template<typename T> void f(T *p) { p->A::~A(); }
|
|
|
|
|
|
|
|
// CHECK: define {{.*}} @_ZN7PR127981fINS_1AEEEvPT_(
|
|
|
|
// CHECK: call void @_ZN7PR127981AD1Ev(
|
|
|
|
template void f(A*);
|
|
|
|
}
|