2014-09-12 12:38:08 +08:00
|
|
|
// RUN: %clang_cc1 -std=c++11 -fms-extensions -fno-rtti -emit-llvm -o %t.ll -fdump-vtable-layouts %s -triple=i386-pc-win32 >%t
|
2014-03-24 03:09:08 +08:00
|
|
|
// RUN: FileCheck %s < %t
|
2013-11-09 05:28:00 +08:00
|
|
|
// RUN: FileCheck --check-prefix=MANGLING %s < %t.ll
|
2013-09-27 22:48:01 +08:00
|
|
|
|
2013-07-30 17:46:19 +08:00
|
|
|
struct Empty { };
|
|
|
|
|
|
|
|
struct A {
|
|
|
|
virtual void f();
|
|
|
|
virtual void z(); // Useful to check there are no thunks for f() when appropriate.
|
|
|
|
};
|
|
|
|
|
|
|
|
struct B {
|
|
|
|
virtual void g();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct C: virtual A {
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'A' in 'C' (2 entries)
|
|
|
|
// CHECK-NEXT: 0 | void C::f()
|
|
|
|
// CHECK-NEXT: 1 | void A::z()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable indices for 'C' (1 entry)
|
|
|
|
// CHECK-NEXT: vbtable index 1, vfptr at offset 0
|
|
|
|
// CHECK-NEXT: 0 | void C::f()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2013-09-27 22:48:01 +08:00
|
|
|
// MANGLING-DAG: @"\01??_7C@@6B@"
|
|
|
|
|
2014-03-07 17:34:59 +08:00
|
|
|
virtual void f() {}
|
2013-07-30 17:46:19 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
C c;
|
2014-03-24 03:09:08 +08:00
|
|
|
void use(C *obj) { obj->f(); }
|
2013-07-30 17:46:19 +08:00
|
|
|
|
|
|
|
struct D: virtual A {
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'D' (1 entry).
|
|
|
|
// CHECK-NEXT: 0 | void D::h()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'A' in 'D' (2 entries).
|
|
|
|
// CHECK-NEXT: 0 | void D::f()
|
|
|
|
// CHECK-NEXT: 1 | void A::z()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable indices for 'D' (2 entries).
|
|
|
|
// CHECK-NEXT: via vfptr at offset 0
|
|
|
|
// CHECK-NEXT: 0 | void D::h()
|
|
|
|
// CHECK-NEXT: via vbtable index 1, vfptr at offset 0
|
|
|
|
// CHECK-NEXT: 0 | void D::f()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2013-09-27 22:48:01 +08:00
|
|
|
// MANGLING-DAG: @"\01??_7D@@6B0@@"
|
|
|
|
// MANGLING-DAG: @"\01??_7D@@6BA@@@"
|
|
|
|
|
2013-07-30 17:46:19 +08:00
|
|
|
virtual void f();
|
|
|
|
virtual void h();
|
|
|
|
};
|
|
|
|
|
|
|
|
D d;
|
2014-03-24 03:09:08 +08:00
|
|
|
void use(D *obj) { obj->h(); }
|
2013-07-30 17:46:19 +08:00
|
|
|
|
|
|
|
namespace Test1 {
|
|
|
|
|
|
|
|
struct X { int x; };
|
|
|
|
|
|
|
|
// X and A get reordered in the layout since X doesn't have a vfptr while A has.
|
|
|
|
struct Y : X, A { };
|
2013-09-27 22:48:01 +08:00
|
|
|
// MANGLING-DAG: @"\01??_7Y@Test1@@6B@"
|
2013-07-30 17:46:19 +08:00
|
|
|
|
|
|
|
struct Z : virtual Y {
|
2014-03-24 03:09:08 +08:00
|
|
|
Z();
|
|
|
|
// CHECK-LABEL: VFTable for 'A' in 'Test1::Y' in 'Test1::Z' (2 entries).
|
|
|
|
// CHECK-NEXT: 0 | void A::f()
|
|
|
|
// CHECK-NEXT: 1 | void A::z()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-NOT: VFTable indices for 'Test1::Z'
|
2013-09-27 22:48:01 +08:00
|
|
|
|
|
|
|
// MANGLING-DAG: @"\01??_7Z@Test1@@6B@"
|
2013-07-30 17:46:19 +08:00
|
|
|
};
|
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
Z::Z() {}
|
2013-07-30 17:46:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace Test2 {
|
|
|
|
|
|
|
|
struct X: virtual A, virtual B {
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'Test2::X' (1 entry).
|
|
|
|
// CHECK-NEXT: 0 | void Test2::X::h()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'A' in 'Test2::X' (2 entries).
|
|
|
|
// CHECK-NEXT: 0 | void A::f()
|
|
|
|
// CHECK-NEXT: 1 | void A::z()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'B' in 'Test2::X' (1 entry).
|
|
|
|
// CHECK-NEXT: 0 | void B::g()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable indices for 'Test2::X' (1 entry).
|
|
|
|
// CHECK-NEXT: 0 | void Test2::X::h()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2013-09-27 22:48:01 +08:00
|
|
|
// MANGLING-DAG: @"\01??_7X@Test2@@6B01@@"
|
|
|
|
// MANGLING-DAG: @"\01??_7X@Test2@@6BA@@@"
|
|
|
|
// MANGLING-DAG: @"\01??_7X@Test2@@6BB@@@"
|
|
|
|
|
2013-07-30 17:46:19 +08:00
|
|
|
virtual void h();
|
|
|
|
};
|
|
|
|
|
|
|
|
X x;
|
2014-03-24 03:09:08 +08:00
|
|
|
void use(X *obj) { obj->h(); }
|
2013-07-30 17:46:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace Test3 {
|
|
|
|
|
2013-09-27 22:48:01 +08:00
|
|
|
struct X : virtual A {
|
|
|
|
// MANGLING-DAG: @"\01??_7X@Test3@@6B@"
|
|
|
|
};
|
2013-07-30 17:46:19 +08:00
|
|
|
|
|
|
|
struct Y: virtual X {
|
2014-03-24 03:09:08 +08:00
|
|
|
Y();
|
|
|
|
// CHECK-LABEL: VFTable for 'A' in 'Test3::X' in 'Test3::Y' (2 entries).
|
|
|
|
// CHECK-NEXT: 0 | void A::f()
|
|
|
|
// CHECK-NEXT: 1 | void A::z()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-NOT: VFTable indices for 'Test3::Y'
|
2013-09-27 22:48:01 +08:00
|
|
|
|
|
|
|
// MANGLING-DAG: @"\01??_7Y@Test3@@6B@"
|
2013-07-30 17:46:19 +08:00
|
|
|
};
|
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
Y::Y() {}
|
2013-07-30 17:46:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace Test4 {
|
|
|
|
|
|
|
|
struct X: virtual C {
|
2014-03-24 03:09:08 +08:00
|
|
|
X();
|
2013-07-30 17:46:19 +08:00
|
|
|
// This one's interesting. C::f expects (A*) to be passed as 'this' and does
|
|
|
|
// ECX-=4 to cast to (C*). In X, C and A vbases are reordered, so the thunk
|
|
|
|
// should pass a pointer to the end of X in order
|
|
|
|
// for ECX-=4 to point at the C part.
|
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'A' in 'C' in 'Test4::X' (2 entries).
|
|
|
|
// CHECK-NEXT: 0 | void C::f()
|
|
|
|
// CHECK-NEXT: [this adjustment: 8 non-virtual]
|
|
|
|
// CHECK-NEXT: 1 | void A::z()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: Thunks for 'void C::f()' (1 entry).
|
|
|
|
// CHECK-NEXT: 0 | [this adjustment: 8 non-virtual]
|
2014-03-07 17:34:59 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-NOT: VFTable indices for 'Test4::X'
|
2013-09-27 22:48:01 +08:00
|
|
|
|
|
|
|
// MANGLING-DAG: @"\01??_7X@Test4@@6B@"
|
2013-10-09 17:23:58 +08:00
|
|
|
|
|
|
|
// Also check the mangling of the thunk.
|
2014-06-07 04:04:01 +08:00
|
|
|
// MANGLING-DAG: define linkonce_odr x86_thiscallcc void @"\01?f@C@@WPPPPPPPI@AEXXZ"
|
2013-07-30 17:46:19 +08:00
|
|
|
};
|
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
X::X() {}
|
2013-07-30 17:46:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace Test5 {
|
|
|
|
|
|
|
|
// New methods are added to the base's vftable.
|
|
|
|
struct X : A {
|
2013-09-27 22:48:01 +08:00
|
|
|
// MANGLING-DAG: @"\01??_7X@Test5@@6B@"
|
2013-07-30 17:46:19 +08:00
|
|
|
virtual void g();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Y : virtual X {
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'Test5::Y' (1 entry).
|
|
|
|
// CHECK-NEXT: 0 | void Test5::Y::h()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'A' in 'Test5::X' in 'Test5::Y' (3 entries).
|
|
|
|
// CHECK-NEXT: 0 | void A::f()
|
|
|
|
// CHECK-NEXT: 1 | void A::z()
|
|
|
|
// CHECK-NEXT: 2 | void Test5::X::g()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable indices for 'Test5::Y' (1 entry).
|
|
|
|
// CHECK-NEXT: 0 | void Test5::Y::h()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2013-09-27 22:48:01 +08:00
|
|
|
// MANGLING-DAG: @"\01??_7Y@Test5@@6B01@@"
|
|
|
|
// MANGLING-DAG: @"\01??_7Y@Test5@@6BX@1@@"
|
|
|
|
|
2013-07-30 17:46:19 +08:00
|
|
|
virtual void h();
|
|
|
|
};
|
|
|
|
|
|
|
|
Y y;
|
2014-03-24 03:09:08 +08:00
|
|
|
void use(Y *obj) { obj->h(); }
|
2013-07-30 17:46:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace Test6 {
|
|
|
|
|
|
|
|
struct X : A, virtual Empty {
|
2014-03-24 03:09:08 +08:00
|
|
|
X();
|
|
|
|
// CHECK-LABEL: VFTable for 'A' in 'Test6::X' (2 entries).
|
|
|
|
// CHECK-NEXT: 0 | void A::f()
|
|
|
|
// CHECK-NEXT: 1 | void A::z()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-NOT: VFTable indices for 'Test6::X'
|
2013-09-27 22:48:01 +08:00
|
|
|
|
|
|
|
// MANGLING-DAG: @"\01??_7X@Test6@@6B@"
|
2013-07-30 17:46:19 +08:00
|
|
|
};
|
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
X::X() {}
|
2013-07-30 17:46:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace Test7 {
|
|
|
|
|
2013-09-27 22:48:01 +08:00
|
|
|
struct X : C {
|
|
|
|
// MANGLING-DAG: @"\01??_7X@Test7@@6B@"
|
|
|
|
};
|
2013-07-30 17:46:19 +08:00
|
|
|
|
|
|
|
struct Y : virtual X {
|
2014-03-24 03:09:08 +08:00
|
|
|
Y();
|
|
|
|
// CHECK-LABEL: VFTable for 'A' in 'C' in 'Test7::X' in 'Test7::Y' (2 entries).
|
|
|
|
// CHECK-NEXT: 0 | void C::f()
|
|
|
|
// CHECK-NEXT: [this adjustment: 8 non-virtual]
|
|
|
|
// CHECK-NEXT: 1 | void A::z()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: Thunks for 'void C::f()' (1 entry).
|
|
|
|
// CHECK-NEXT: 0 | [this adjustment: 8 non-virtual]
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-NOT: VFTable indices for 'Test7::Y'
|
2013-09-27 22:48:01 +08:00
|
|
|
|
|
|
|
// MANGLING-DAG: @"\01??_7Y@Test7@@6B@"
|
2013-07-30 17:46:19 +08:00
|
|
|
};
|
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
Y::Y() {}
|
2013-07-30 17:46:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace Test8 {
|
|
|
|
|
|
|
|
// This is a typical diamond inheritance with a shared 'A' vbase.
|
|
|
|
struct X : D, C {
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'D' in 'Test8::X' (1 entry).
|
|
|
|
// CHECK-NEXT: 0 | void D::h()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'A' in 'D' in 'Test8::X' (2 entries).
|
|
|
|
// CHECK-NEXT: 0 | void Test8::X::f()
|
|
|
|
// CHECK-NEXT: 1 | void A::z()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable indices for 'Test8::X' (1 entry).
|
|
|
|
// CHECK-NEXT: via vbtable index 1, vfptr at offset 0
|
|
|
|
// CHECK-NEXT: 0 | void Test8::X::f()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2013-09-27 22:48:01 +08:00
|
|
|
// MANGLING-DAG: @"\01??_7X@Test8@@6BA@@@"
|
|
|
|
// MANGLING-DAG: @"\01??_7X@Test8@@6BD@@@"
|
|
|
|
|
2013-07-30 17:46:19 +08:00
|
|
|
virtual void f();
|
|
|
|
};
|
|
|
|
|
|
|
|
X x;
|
2014-03-24 03:09:08 +08:00
|
|
|
void use(X *obj) { obj->f(); }
|
2013-10-29 22:13:45 +08:00
|
|
|
|
|
|
|
// Another diamond inheritance which led to AST crashes.
|
|
|
|
struct Y : virtual A {};
|
|
|
|
|
2014-03-07 17:34:59 +08:00
|
|
|
struct Z : Y, C {
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'A' in 'Test8::Y' in 'Test8::Z' (2 entries).
|
|
|
|
// CHECK-NEXT: 0 | void Test8::Z::f()
|
|
|
|
// CHECK-NEXT: 1 | void A::z()
|
2013-10-29 22:13:45 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable indices for 'Test8::Z' (1 entry).
|
|
|
|
// CHECK-NEXT: via vbtable index 1, vfptr at offset 0
|
|
|
|
// CHECK-NEXT: 0 | void Test8::Z::f()
|
2013-10-29 22:13:45 +08:00
|
|
|
virtual void f();
|
|
|
|
};
|
|
|
|
Z z;
|
2014-03-24 03:09:08 +08:00
|
|
|
void use(Z *obj) { obj->f(); }
|
2014-03-07 17:34:59 +08:00
|
|
|
|
|
|
|
// Another diamond inheritance which we miscompiled (PR18967).
|
|
|
|
struct W : virtual A {
|
|
|
|
virtual void bar();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct T : W, C {
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'Test8::W' in 'Test8::T' (1 entry)
|
|
|
|
// CHECK-NEXT: 0 | void Test8::T::bar()
|
2014-03-07 17:34:59 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'A' in 'Test8::W' in 'Test8::T' (2 entries)
|
|
|
|
// CHECK-NEXT: 0 | void C::f()
|
|
|
|
// CHECK-NEXT: [this adjustment: -4 non-virtual]
|
|
|
|
// CHECK-NEXT: 1 | void A::z()
|
2014-03-07 17:34:59 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: Thunks for 'void C::f()' (1 entry).
|
|
|
|
// CHECK-NEXT: 0 | [this adjustment: -4 non-virtual]
|
2014-03-07 17:34:59 +08:00
|
|
|
virtual void bar();
|
|
|
|
int field;
|
|
|
|
};
|
|
|
|
T t;
|
2014-03-24 03:09:08 +08:00
|
|
|
void use(T *obj) { obj->bar(); }
|
2013-07-30 17:46:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace Test9 {
|
|
|
|
|
|
|
|
struct X : A { };
|
|
|
|
|
|
|
|
struct Y : virtual X {
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'Test9::Y' (1 entry).
|
|
|
|
// CHECK-NEXT: 0 | void Test9::Y::h()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'A' in 'Test9::X' in 'Test9::Y' (2 entries).
|
|
|
|
// CHECK-NEXT: 0 | void A::f()
|
|
|
|
// CHECK-NEXT: 1 | void A::z()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable indices for 'Test9::Y' (1 entry).
|
|
|
|
// CHECK-NEXT: 0 | void Test9::Y::h()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2013-09-27 22:48:01 +08:00
|
|
|
// MANGLING-DAG: @"\01??_7Y@Test9@@6B01@@"
|
|
|
|
// MANGLING-DAG: @"\01??_7Y@Test9@@6BX@1@@"
|
|
|
|
|
2013-07-30 17:46:19 +08:00
|
|
|
virtual void h();
|
|
|
|
};
|
|
|
|
|
|
|
|
Y y;
|
2014-03-24 03:09:08 +08:00
|
|
|
void use(Y *obj) { obj->h(); }
|
2013-07-30 17:46:19 +08:00
|
|
|
|
|
|
|
struct Z : Y, virtual B {
|
2014-03-24 03:09:08 +08:00
|
|
|
Z();
|
|
|
|
// CHECK-LABEL: VFTable for 'Test9::Y' in 'Test9::Z' (1 entry).
|
|
|
|
// CHECK-NEXT: 0 | void Test9::Y::h()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'A' in 'Test9::X' in 'Test9::Y' in 'Test9::Z' (2 entries).
|
|
|
|
// CHECK-NEXT: 0 | void A::f()
|
|
|
|
// CHECK-NEXT: 1 | void A::z()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'B' in 'Test9::Z' (1 entry).
|
|
|
|
// CHECK-NEXT: 0 | void B::g()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-NOT: VFTable indices for 'Test9::Z'
|
2013-09-27 22:48:01 +08:00
|
|
|
|
|
|
|
// MANGLING-DAG: @"\01??_7Z@Test9@@6BX@1@@"
|
|
|
|
// MANGLING-DAG: @"\01??_7Z@Test9@@6BY@1@@"
|
|
|
|
|
2014-02-28 03:40:09 +08:00
|
|
|
// MANGLING-DAG: @"\01??_7Z@Test9@@6B@"
|
2013-07-30 17:46:19 +08:00
|
|
|
};
|
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
Z::Z() {}
|
2013-07-30 17:46:19 +08:00
|
|
|
|
|
|
|
struct W : Z, D, virtual A, virtual B {
|
2014-03-24 03:09:08 +08:00
|
|
|
W();
|
|
|
|
// CHECK-LABEL: VFTable for 'Test9::Y' in 'Test9::Z' in 'Test9::W' (1 entry).
|
|
|
|
// CHECK-NEXT: 0 | void Test9::Y::h()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'A' in 'Test9::X' in 'Test9::Y' in 'Test9::Z' in 'Test9::W' (2 entries).
|
|
|
|
// CHECK-NEXT: 0 | void A::f()
|
|
|
|
// CHECK-NEXT: 1 | void A::z()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'B' in 'Test9::Z' in 'Test9::W' (1 entry).
|
|
|
|
// CHECK-NEXT: 0 | void B::g()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'D' in 'Test9::W' (1 entry).
|
|
|
|
// CHECK-NEXT: 0 | void D::h()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'A' in 'D' in 'Test9::W' (2 entries).
|
|
|
|
// CHECK-NEXT: 0 | void D::f()
|
|
|
|
// CHECK-NEXT: [this adjustment: -8 non-virtual]
|
|
|
|
// CHECK-NEXT: 1 | void A::z()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: Thunks for 'void D::f()' (1 entry).
|
|
|
|
// CHECK-NEXT: 0 | [this adjustment: -8 non-virtual]
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-NOT: VFTable indices for 'Test9::W'
|
2013-09-27 22:48:01 +08:00
|
|
|
|
|
|
|
// MANGLING-DAG: @"\01??_7W@Test9@@6BA@@@"
|
|
|
|
// MANGLING-DAG: @"\01??_7W@Test9@@6BD@@@"
|
|
|
|
// MANGLING-DAG: @"\01??_7W@Test9@@6BX@1@@"
|
|
|
|
|
2014-02-28 03:40:09 +08:00
|
|
|
// MANGLING-DAG: @"\01??_7W@Test9@@6B@"
|
|
|
|
// MANGLING-DAG: @"\01??_7W@Test9@@6BY@1@@"
|
2013-07-30 17:46:19 +08:00
|
|
|
};
|
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
W::W() {}
|
2013-07-30 17:46:19 +08:00
|
|
|
|
|
|
|
struct T : Z, D, virtual A, virtual B {
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'Test9::Y' in 'Test9::Z' in 'Test9::T' (1 entry).
|
|
|
|
// CHECK-NEXT: 0 | void Test9::T::h()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'A' in 'Test9::X' in 'Test9::Y' in 'Test9::Z' in 'Test9::T' (2 entries).
|
|
|
|
// CHECK-NEXT: 0 | void Test9::T::f()
|
|
|
|
// CHECK-NEXT: 1 | void Test9::T::z()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'B' in 'Test9::Z' in 'Test9::T' (1 entry).
|
|
|
|
// CHECK-NEXT: 0 | void Test9::T::g()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'D' in 'Test9::T' (1 entry).
|
|
|
|
// CHECK-NEXT: 0 | void Test9::T::h()
|
|
|
|
// CHECK-NEXT: [this adjustment: -8 non-virtual]
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: Thunks for 'void Test9::T::h()' (1 entry).
|
|
|
|
// CHECK-NEXT: 0 | [this adjustment: -8 non-virtual]
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'A' in 'D' in 'Test9::T' (2 entries).
|
|
|
|
// CHECK-NEXT: 0 | void Test9::T::f()
|
|
|
|
// CHECK-NEXT: [this adjustment: -8 non-virtual]
|
|
|
|
// CHECK-NEXT: 1 | void Test9::T::z()
|
|
|
|
// CHECK-NEXT: [this adjustment: -8 non-virtual]
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: Thunks for 'void Test9::T::f()' (1 entry).
|
|
|
|
// CHECK-NEXT: 0 | [this adjustment: -8 non-virtual]
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: Thunks for 'void Test9::T::z()' (1 entry).
|
|
|
|
// CHECK-NEXT: 0 | [this adjustment: -8 non-virtual]
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable indices for 'Test9::T' (4 entries).
|
|
|
|
// CHECK-NEXT: via vfptr at offset 0
|
|
|
|
// CHECK-NEXT: 0 | void Test9::T::h()
|
|
|
|
// CHECK-NEXT: via vbtable index 1, vfptr at offset 0
|
|
|
|
// CHECK-NEXT: 0 | void Test9::T::f()
|
|
|
|
// CHECK-NEXT: 1 | void Test9::T::z()
|
|
|
|
// CHECK-NEXT: via vbtable index 2, vfptr at offset 0
|
|
|
|
// CHECK-NEXT: 0 | void Test9::T::g()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2013-09-27 22:48:01 +08:00
|
|
|
// MANGLING-DAG: @"\01??_7T@Test9@@6BA@@@"
|
|
|
|
// MANGLING-DAG: @"\01??_7T@Test9@@6BD@@@"
|
|
|
|
// MANGLING-DAG: @"\01??_7T@Test9@@6BX@1@@"
|
|
|
|
|
2014-02-28 03:40:09 +08:00
|
|
|
// MANGLING-DAG: @"\01??_7T@Test9@@6B@"
|
|
|
|
// MANGLING-DAG: @"\01??_7T@Test9@@6BY@1@@"
|
2013-09-27 22:48:01 +08:00
|
|
|
|
2013-07-30 17:46:19 +08:00
|
|
|
virtual void f();
|
|
|
|
virtual void g();
|
|
|
|
virtual void h();
|
|
|
|
virtual void z();
|
|
|
|
};
|
|
|
|
|
|
|
|
T t;
|
2014-03-24 03:09:08 +08:00
|
|
|
void use(T *obj) { obj->f(); }
|
2013-07-30 17:46:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace Test10 {
|
|
|
|
struct X : virtual C, virtual A {
|
2015-05-02 05:35:41 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'A' in 'C' in 'Test10::X' (2 entries).
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-NEXT: 0 | void Test10::X::f()
|
|
|
|
// CHECK-NEXT: 1 | void A::z()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable indices for 'Test10::X' (1 entry).
|
|
|
|
// CHECK-NEXT: via vbtable index 1, vfptr at offset 0
|
|
|
|
// CHECK-NEXT: 0 | void Test10::X::f()
|
2013-07-30 17:46:19 +08:00
|
|
|
virtual void f();
|
|
|
|
};
|
|
|
|
|
|
|
|
void X::f() {}
|
|
|
|
X x;
|
2014-03-24 03:09:08 +08:00
|
|
|
void use(X *obj) { obj->f(); }
|
2013-07-30 17:46:19 +08:00
|
|
|
}
|
|
|
|
|
2013-12-12 19:07:03 +08:00
|
|
|
namespace Test11 {
|
|
|
|
struct X : virtual A {};
|
|
|
|
struct Y { virtual void g(); };
|
|
|
|
|
|
|
|
struct Z : virtual X, Y {
|
|
|
|
// MANGLING-DAG: @"\01??_7Z@Test11@@6BY@1@@"
|
2014-02-28 03:40:09 +08:00
|
|
|
// MANGLING-DAG: @"\01??_7Z@Test11@@6BX@1@@"
|
2013-12-12 19:07:03 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
Z z;
|
|
|
|
|
|
|
|
struct W : virtual X, A {};
|
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// Used to crash, PR17748.
|
|
|
|
W w;
|
2013-12-12 19:07:03 +08:00
|
|
|
}
|
|
|
|
|
2014-04-18 06:01:48 +08:00
|
|
|
namespace Test12 {
|
|
|
|
struct X : B, A { };
|
|
|
|
|
|
|
|
struct Y : X {
|
|
|
|
virtual void f(); // Overrides A::f.
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Z : virtual Y {
|
|
|
|
// CHECK-LABEL: VFTable for 'A' in 'Test12::X' in 'Test12::Y' in 'Test12::Z' (2 entries).
|
|
|
|
// CHECK-NEXT: 0 | void Test12::Y::f()
|
|
|
|
// CHECK-NEXT: 1 | void A::z()
|
|
|
|
|
|
|
|
int z;
|
|
|
|
// MANGLING-DAG: @"\01??_7Z@Test12@@6BA@@@" = {{.*}}@"\01?f@Y@Test12@@UAEXXZ"
|
|
|
|
};
|
|
|
|
|
|
|
|
struct W : Z {
|
|
|
|
// CHECK-LABEL: VFTable for 'A' in 'Test12::X' in 'Test12::Y' in 'Test12::Z' in 'Test12::W' (2 entries).
|
|
|
|
// CHECK-NEXT: 0 | void Test12::Y::f()
|
|
|
|
// CHECK-NEXT: 1 | void A::z()
|
|
|
|
W();
|
|
|
|
|
|
|
|
int w;
|
|
|
|
// MANGLING-DAG: @"\01??_7W@Test12@@6BA@@@" = {{.*}}@"\01?f@Y@Test12@@UAEXXZ"
|
|
|
|
};
|
|
|
|
|
|
|
|
W::W() {}
|
|
|
|
}
|
|
|
|
|
2013-10-17 02:24:06 +08:00
|
|
|
namespace vdtors {
|
|
|
|
struct X {
|
|
|
|
virtual ~X();
|
|
|
|
virtual void zzz();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Y : virtual X {
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'vdtors::X' in 'vdtors::Y' (2 entries).
|
|
|
|
// CHECK-NEXT: 0 | vdtors::Y::~Y() [scalar deleting]
|
|
|
|
// CHECK-NEXT: 1 | void vdtors::X::zzz()
|
2013-10-17 02:24:06 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-NOT: Thunks for 'vdtors::Y::~Y()'
|
2013-10-17 02:24:06 +08:00
|
|
|
virtual ~Y();
|
|
|
|
};
|
|
|
|
|
|
|
|
Y y;
|
2014-03-24 03:09:08 +08:00
|
|
|
void use(Y *obj) { delete obj; }
|
2013-10-17 02:24:06 +08:00
|
|
|
|
|
|
|
struct Z {
|
|
|
|
virtual void z();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct W : Z, X {
|
|
|
|
// Implicit virtual dtor.
|
|
|
|
};
|
|
|
|
|
|
|
|
struct U : virtual W {
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'vdtors::Z' in 'vdtors::W' in 'vdtors::U' (1 entry).
|
|
|
|
// CHECK-NEXT: 0 | void vdtors::Z::z()
|
2013-10-17 02:24:06 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'vdtors::X' in 'vdtors::W' in 'vdtors::U' (2 entries).
|
|
|
|
// CHECK-NEXT: 0 | vdtors::U::~U() [scalar deleting]
|
|
|
|
// CHECK-NEXT: [this adjustment: -4 non-virtual]
|
|
|
|
// CHECK-NEXT: 1 | void vdtors::X::zzz()
|
2013-10-17 02:24:06 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: Thunks for 'vdtors::U::~U()' (1 entry).
|
|
|
|
// CHECK-NEXT: 0 | [this adjustment: -4 non-virtual]
|
2013-10-17 02:24:06 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable indices for 'vdtors::U' (1 entry).
|
|
|
|
// CHECK-NEXT: -- accessible via vbtable index 1, vfptr at offset 4 --
|
|
|
|
// CHECK-NEXT: 0 | vdtors::U::~U() [scalar deleting]
|
2013-10-17 02:24:06 +08:00
|
|
|
virtual ~U();
|
|
|
|
};
|
|
|
|
|
|
|
|
U u;
|
2014-03-24 03:09:08 +08:00
|
|
|
void use(U *obj) { delete obj; }
|
2013-10-17 02:24:06 +08:00
|
|
|
|
|
|
|
struct V : virtual W {
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'vdtors::Z' in 'vdtors::W' in 'vdtors::V' (1 entry).
|
|
|
|
// CHECK-NEXT: 0 | void vdtors::Z::z()
|
2013-10-17 02:24:06 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'vdtors::X' in 'vdtors::W' in 'vdtors::V' (2 entries).
|
|
|
|
// CHECK-NEXT: 0 | vdtors::V::~V() [scalar deleting]
|
|
|
|
// CHECK-NEXT: [this adjustment: -4 non-virtual]
|
|
|
|
// CHECK-NEXT: 1 | void vdtors::X::zzz()
|
2013-10-17 02:24:06 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: Thunks for 'vdtors::V::~V()' (1 entry).
|
|
|
|
// CHECK-NEXT: 0 | [this adjustment: -4 non-virtual]
|
2013-10-17 02:24:06 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable indices for 'vdtors::V' (1 entry).
|
|
|
|
// CHECK-NEXT: -- accessible via vbtable index 1, vfptr at offset 4 --
|
|
|
|
// CHECK-NEXT: 0 | vdtors::V::~V() [scalar deleting]
|
2013-10-17 02:24:06 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
V v;
|
2014-03-24 03:09:08 +08:00
|
|
|
void use(V *obj) { delete obj; }
|
2013-10-17 02:24:06 +08:00
|
|
|
|
|
|
|
struct T : virtual X {
|
|
|
|
virtual ~T();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct P : T, Y {
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'vdtors::X' in 'vdtors::T' in 'vdtors::P' (2 entries).
|
|
|
|
// CHECK-NEXT: 0 | vdtors::P::~P() [scalar deleting]
|
|
|
|
// CHECK-NEXT: 1 | void vdtors::X::zzz()
|
2013-10-17 02:24:06 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-NOT: Thunks for 'vdtors::P::~P()'
|
2013-10-17 02:24:06 +08:00
|
|
|
virtual ~P();
|
|
|
|
};
|
|
|
|
|
|
|
|
P p;
|
2014-03-24 03:09:08 +08:00
|
|
|
void use(P *obj) { delete obj; }
|
2013-10-17 02:24:06 +08:00
|
|
|
|
2014-03-21 04:38:34 +08:00
|
|
|
struct Q {
|
|
|
|
virtual ~Q();
|
|
|
|
};
|
|
|
|
|
|
|
|
// PR19172: Yet another diamond we miscompiled.
|
|
|
|
struct R : virtual Q, X {
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'vdtors::Q' in 'vdtors::R' (1 entry).
|
|
|
|
// CHECK-NEXT: 0 | vdtors::R::~R() [scalar deleting]
|
|
|
|
// CHECK-NEXT: [this adjustment: -8 non-virtual]
|
2014-03-21 04:38:34 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: Thunks for 'vdtors::R::~R()' (1 entry).
|
|
|
|
// CHECK-NEXT: 0 | [this adjustment: -8 non-virtual]
|
2014-03-21 04:38:34 +08:00
|
|
|
|
2014-09-23 07:14:46 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'vdtors::X' in 'vdtors::R' (2 entries).
|
|
|
|
// CHECK-NEXT: 0 | vdtors::R::~R() [scalar deleting]
|
|
|
|
// CHECK-NEXT: 1 | void vdtors::X::zzz()
|
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable indices for 'vdtors::R' (1 entry).
|
|
|
|
// CHECK-NEXT: 0 | vdtors::R::~R() [scalar deleting]
|
2014-03-21 04:38:34 +08:00
|
|
|
virtual ~R();
|
|
|
|
};
|
|
|
|
|
|
|
|
R r;
|
2014-03-24 03:09:08 +08:00
|
|
|
void use(R *obj) { delete obj; }
|
2013-10-17 02:24:06 +08:00
|
|
|
}
|
|
|
|
|
2013-07-30 17:46:19 +08:00
|
|
|
namespace return_adjustment {
|
|
|
|
|
|
|
|
struct X : virtual A {
|
|
|
|
virtual void f();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Y : virtual A, virtual X {
|
|
|
|
virtual void f();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Z {
|
|
|
|
virtual A* foo();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct W : Z {
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'return_adjustment::Z' in 'return_adjustment::W' (2 entries).
|
|
|
|
// CHECK-NEXT: 0 | return_adjustment::X *return_adjustment::W::foo()
|
|
|
|
// CHECK-NEXT: [return adjustment (to type 'struct A *'): vbase #1, 0 non-virtual]
|
|
|
|
// CHECK-NEXT: 1 | return_adjustment::X *return_adjustment::W::foo()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: Thunks for 'return_adjustment::X *return_adjustment::W::foo()' (1 entry).
|
|
|
|
// CHECK-NEXT: 0 | [return adjustment (to type 'struct A *'): vbase #1, 0 non-virtual]
|
2014-03-07 17:34:59 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable indices for 'return_adjustment::W' (1 entry).
|
|
|
|
// CHECK-NEXT: 1 | return_adjustment::X *return_adjustment::W::foo()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
|
|
|
virtual X* foo();
|
|
|
|
};
|
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
W w;
|
|
|
|
void use(W *obj) { obj->foo(); }
|
2013-07-30 17:46:19 +08:00
|
|
|
|
|
|
|
struct T : W {
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'return_adjustment::Z' in 'return_adjustment::W' in 'return_adjustment::T' (3 entries).
|
|
|
|
// CHECK-NEXT: 0 | return_adjustment::Y *return_adjustment::T::foo()
|
|
|
|
// CHECK-NEXT: [return adjustment (to type 'struct A *'): vbase #1, 0 non-virtual]
|
|
|
|
// CHECK-NEXT: 1 | return_adjustment::Y *return_adjustment::T::foo()
|
|
|
|
// CHECK-NEXT: [return adjustment (to type 'struct return_adjustment::X *'): vbase #2, 0 non-virtual]
|
|
|
|
// CHECK-NEXT: 2 | return_adjustment::Y *return_adjustment::T::foo()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: Thunks for 'return_adjustment::Y *return_adjustment::T::foo()' (2 entries).
|
|
|
|
// CHECK-NEXT: 0 | [return adjustment (to type 'struct A *'): vbase #1, 0 non-virtual]
|
|
|
|
// CHECK-NEXT: 1 | [return adjustment (to type 'struct return_adjustment::X *'): vbase #2, 0 non-virtual]
|
2014-03-07 17:34:59 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable indices for 'return_adjustment::T' (1 entry).
|
|
|
|
// CHECK-NEXT: 2 | return_adjustment::Y *return_adjustment::T::foo()
|
2013-07-30 17:46:19 +08:00
|
|
|
|
|
|
|
virtual Y* foo();
|
|
|
|
};
|
|
|
|
|
|
|
|
T t;
|
2014-03-24 03:09:08 +08:00
|
|
|
void use(T *obj) { obj->foo(); }
|
2013-10-30 19:55:43 +08:00
|
|
|
|
|
|
|
struct U : virtual A {
|
|
|
|
virtual void g(); // adds a vfptr
|
|
|
|
};
|
|
|
|
|
|
|
|
struct V : Z {
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'return_adjustment::Z' in 'return_adjustment::V' (2 entries).
|
|
|
|
// CHECK-NEXT: 0 | return_adjustment::U *return_adjustment::V::foo()
|
|
|
|
// CHECK-NEXT: [return adjustment (to type 'struct A *'): vbptr at offset 4, vbase #1, 0 non-virtual]
|
|
|
|
// CHECK-NEXT: 1 | return_adjustment::U *return_adjustment::V::foo()
|
2013-10-30 19:55:43 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: Thunks for 'return_adjustment::U *return_adjustment::V::foo()' (1 entry).
|
|
|
|
// CHECK-NEXT: 0 | [return adjustment (to type 'struct A *'): vbptr at offset 4, vbase #1, 0 non-virtual]
|
2014-03-07 17:34:59 +08:00
|
|
|
|
2014-03-24 03:09:08 +08:00
|
|
|
// CHECK-LABEL: VFTable indices for 'return_adjustment::V' (1 entry).
|
|
|
|
// CHECK-NEXT: 1 | return_adjustment::U *return_adjustment::V::foo()
|
2013-10-30 19:55:43 +08:00
|
|
|
|
|
|
|
virtual U* foo();
|
|
|
|
};
|
|
|
|
|
|
|
|
V v;
|
2014-03-24 03:09:08 +08:00
|
|
|
void use(V *obj) { obj->foo(); }
|
2013-07-30 17:46:19 +08:00
|
|
|
}
|
2014-02-28 03:40:09 +08:00
|
|
|
|
|
|
|
namespace pr17748 {
|
|
|
|
struct A {
|
|
|
|
virtual void f() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct B : virtual A {
|
|
|
|
B() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct C : virtual B, A {
|
|
|
|
C() {}
|
|
|
|
};
|
|
|
|
C c;
|
|
|
|
|
|
|
|
// MANGLING-DAG: @"\01??_7A@pr17748@@6B@"
|
|
|
|
// MANGLING-DAG: @"\01??_7B@pr17748@@6B@"
|
|
|
|
// MANGLING-DAG: @"\01??_7C@pr17748@@6BA@1@@"
|
|
|
|
// MANGLING-DAG: @"\01??_7C@pr17748@@6BB@1@@"
|
|
|
|
}
|
2014-03-26 02:33:27 +08:00
|
|
|
|
2014-03-26 16:12:53 +08:00
|
|
|
namespace pr19066 {
|
|
|
|
struct X : virtual B {};
|
|
|
|
|
|
|
|
struct Y : virtual X, B {
|
|
|
|
Y();
|
2014-09-23 07:14:46 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'B' in 'pr19066::X' in 'pr19066::Y' (1 entry).
|
2014-03-26 16:12:53 +08:00
|
|
|
// CHECK-NEXT: 0 | void B::g()
|
|
|
|
|
2014-09-23 07:14:46 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'B' in 'pr19066::Y' (1 entry).
|
2014-03-26 16:12:53 +08:00
|
|
|
// CHECK-NEXT: 0 | void B::g()
|
|
|
|
};
|
|
|
|
|
|
|
|
Y::Y() {}
|
|
|
|
}
|
|
|
|
|
2014-03-26 02:33:27 +08:00
|
|
|
namespace pr19240 {
|
|
|
|
struct A {
|
|
|
|
virtual void c();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct B : virtual A {
|
|
|
|
virtual void c();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct C { };
|
|
|
|
|
|
|
|
struct D : virtual A, virtual C, B {};
|
|
|
|
|
|
|
|
D obj;
|
|
|
|
|
|
|
|
// Each MDC only has one vftable.
|
|
|
|
|
|
|
|
// MANGLING-DAG: @"\01??_7D@pr19240@@6B@"
|
|
|
|
// MANGLING-DAG: @"\01??_7A@pr19240@@6B@"
|
|
|
|
// MANGLING-DAG: @"\01??_7B@pr19240@@6B@"
|
|
|
|
|
|
|
|
}
|
2014-04-18 06:01:48 +08:00
|
|
|
|
|
|
|
namespace pr19408 {
|
|
|
|
// This test is a non-vtordisp version of the reproducer for PR19408.
|
|
|
|
struct X : virtual A {
|
|
|
|
int x;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Y : X {
|
|
|
|
virtual void f();
|
|
|
|
int y;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Z : Y {
|
|
|
|
// CHECK-LABEL: VFTable for 'A' in 'pr19408::X' in 'pr19408::Y' in 'pr19408::Z' (2 entries).
|
|
|
|
// CHECK-NEXT: 0 | void pr19408::Y::f()
|
|
|
|
// CHECK-NEXT: [this adjustment: -4 non-virtual]
|
|
|
|
// CHECK-NEXT: 1 | void A::z()
|
|
|
|
|
|
|
|
Z();
|
|
|
|
int z;
|
|
|
|
// MANGLING-DAG: @"\01??_7Z@pr19408@@6B@" = {{.*}}@"\01?f@Y@pr19408@@W3AEXXZ"
|
|
|
|
};
|
|
|
|
|
|
|
|
Z::Z() {}
|
|
|
|
|
|
|
|
struct W : B, Y {
|
|
|
|
// CHECK-LABEL: VFTable for 'A' in 'pr19408::X' in 'pr19408::Y' in 'pr19408::W' (2 entries).
|
|
|
|
// CHECK-NEXT: 0 | void pr19408::Y::f()
|
|
|
|
// CHECK-NEXT: [this adjustment: -4 non-virtual]
|
|
|
|
// CHECK-NEXT: 1 | void A::z()
|
|
|
|
|
|
|
|
W();
|
|
|
|
int w;
|
|
|
|
// MANGLING-DAG: @"\01??_7W@pr19408@@6BY@1@@" = {{.*}}@"\01?f@Y@pr19408@@W3AEXXZ"
|
|
|
|
};
|
|
|
|
|
|
|
|
W::W() {}
|
|
|
|
}
|
2014-09-12 12:38:08 +08:00
|
|
|
|
|
|
|
namespace Test13 {
|
2014-10-03 15:54:12 +08:00
|
|
|
struct A {
|
|
|
|
virtual void f();
|
|
|
|
};
|
|
|
|
struct __declspec(dllexport) B : virtual A {
|
|
|
|
virtual void f() = 0;
|
2014-10-03 16:03:23 +08:00
|
|
|
// MANGLING-DAG: @"\01??_7B@Test13@@6B@" = weak_odr dllexport unnamed_addr constant [1 x i8*] [i8* bitcast (void ()* @_purecall to i8*)]
|
2014-10-03 15:54:12 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2014-09-23 07:14:46 +08:00
|
|
|
namespace pr21031_1 {
|
|
|
|
// This ordering of base specifiers regressed in r202425.
|
|
|
|
struct A { virtual void f(void); };
|
|
|
|
struct B : virtual A { virtual void g(void); };
|
|
|
|
struct C : virtual A, B { C(); };
|
|
|
|
C::C() {}
|
|
|
|
|
2015-05-05 02:47:54 +08:00
|
|
|
// CHECK-LABEL: VFTable for 'pr21031_1::A' in 'pr21031_1::B' in 'pr21031_1::C' (1 entry)
|
2014-09-23 07:14:46 +08:00
|
|
|
// CHECK-NEXT: 0 | void pr21031_1::A::f()
|
|
|
|
|
|
|
|
// CHECK-LABEL: VFTable for 'pr21031_1::B' in 'pr21031_1::C' (1 entry)
|
|
|
|
// CHECK-NEXT: 0 | void pr21031_1::B::g()
|
|
|
|
|
|
|
|
// MANGLING-DAG: @"\01??_7C@pr21031_1@@6BB@1@@" = {{.*}} constant [1 x i8*]
|
|
|
|
// MANGLING-DAG: @"\01??_7C@pr21031_1@@6B@" = {{.*}} constant [1 x i8*]
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace pr21031_2 {
|
|
|
|
struct A { virtual void f(void); };
|
|
|
|
struct B : virtual A { virtual void g(void); };
|
|
|
|
struct C : B, virtual A { C(); };
|
|
|
|
C::C() {}
|
|
|
|
|
|
|
|
// CHECK-LABEL: VFTable for 'pr21031_2::B' in 'pr21031_2::C' (1 entry)
|
|
|
|
// CHECK-NEXT: 0 | void pr21031_2::B::g()
|
|
|
|
|
|
|
|
// CHECK-LABEL: VFTable for 'pr21031_2::A' in 'pr21031_2::B' in 'pr21031_2::C' (1 entry)
|
|
|
|
// CHECK-NEXT: 0 | void pr21031_2::A::f()
|
|
|
|
|
|
|
|
// MANGLING-DAG: @"\01??_7C@pr21031_2@@6BA@1@@" = {{.*}} constant [1 x i8*]
|
|
|
|
// MANGLING-DAG: @"\01??_7C@pr21031_2@@6BB@1@@" = {{.*}} constant [1 x i8*]
|
|
|
|
}
|
2015-04-28 01:19:49 +08:00
|
|
|
|
|
|
|
namespace pr21062_1 {
|
|
|
|
struct A { virtual void f(); };
|
|
|
|
struct B {};
|
|
|
|
struct C : virtual B {};
|
|
|
|
struct D : virtual C, virtual B, virtual A { D();};
|
|
|
|
D::D() {}
|
|
|
|
|
|
|
|
// CHECK-LABEL: VFTable for 'pr21062_1::A' in 'pr21062_1::D' (1 entry)
|
|
|
|
// CHECK-NEXT: 0 | void pr21062_1::A::f()
|
|
|
|
|
|
|
|
// MANGLING-DAG: @"\01??_7D@pr21062_1@@6B@" = {{.*}} constant [1 x i8*]
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace pr21062_2 {
|
|
|
|
struct A { virtual void f(); };
|
|
|
|
struct B {};
|
|
|
|
struct C : virtual B {};
|
|
|
|
struct D : C, virtual B, virtual A { D(); };
|
|
|
|
D::D() {}
|
|
|
|
|
|
|
|
// CHECK-LABEL: VFTable for 'pr21062_2::A' in 'pr21062_2::D' (1 entry)
|
|
|
|
// CHECK-NEXT: 0 | void pr21062_2::A::f()
|
|
|
|
|
|
|
|
// MANGLING-DAG: @"\01??_7D@pr21062_2@@6B@" = {{.*}} constant [1 x i8*]
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace pr21064 {
|
|
|
|
struct A {};
|
|
|
|
struct B { virtual void f(); };
|
|
|
|
struct C : virtual A, virtual B {};
|
|
|
|
struct D : virtual A, virtual C { D(); };
|
|
|
|
D::D() {}
|
|
|
|
// CHECK-LABEL: VFTable for 'pr21064::B' in 'pr21064::C' in 'pr21064::D' (1 entry)
|
|
|
|
// CHECK-NEXT: 0 | void pr21064::B::f()
|
|
|
|
|
|
|
|
// MANGLING-DAG: @"\01??_7D@pr21064@@6B@" = {{.*}} constant [1 x i8*]
|
|
|
|
}
|