2012-10-17 06:56:05 +08:00
|
|
|
// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -std=c++11 -emit-llvm -o - | FileCheck %s
|
2010-01-18 12:25:18 +08:00
|
|
|
|
2010-01-19 01:13:59 +08:00
|
|
|
// Test1::B should just have a single entry in its VTT, which points to the vtable.
|
2010-01-18 12:25:18 +08:00
|
|
|
namespace Test1 {
|
|
|
|
struct A { };
|
|
|
|
|
|
|
|
struct B : virtual A {
|
|
|
|
virtual void f();
|
|
|
|
};
|
|
|
|
|
|
|
|
void B::f() { }
|
|
|
|
}
|
|
|
|
|
2010-01-19 01:13:59 +08:00
|
|
|
// Check that we don't add a secondary virtual pointer for Test2::A, since Test2::A doesn't have any virtual member functions or bases.
|
2010-01-18 12:25:18 +08:00
|
|
|
namespace Test2 {
|
|
|
|
struct A { };
|
|
|
|
|
|
|
|
struct B : A { virtual void f(); };
|
|
|
|
struct C : virtual B { };
|
|
|
|
|
|
|
|
C c;
|
|
|
|
}
|
|
|
|
|
2010-01-19 01:13:59 +08:00
|
|
|
// This is the sample from the C++ Itanium ABI, p2.6.2.
|
|
|
|
namespace Test3 {
|
|
|
|
class A1 { int i; };
|
|
|
|
class A2 { int i; virtual void f(); };
|
|
|
|
class V1 : public A1, public A2 { int i; };
|
|
|
|
class B1 { int i; };
|
|
|
|
class B2 { int i; };
|
|
|
|
class V2 : public B1, public B2, public virtual V1 { int i; };
|
|
|
|
class V3 {virtual void g(); };
|
|
|
|
class C1 : public virtual V1 { int i; };
|
|
|
|
class C2 : public virtual V3, virtual V2 { int i; };
|
|
|
|
class X1 { int i; };
|
|
|
|
class C3 : public X1 { int i; };
|
|
|
|
class D : public C1, public C2, public C3 { int i; };
|
|
|
|
|
|
|
|
D d;
|
|
|
|
}
|
|
|
|
|
|
|
|
// This is the sample from the C++ Itanium ABI, p2.6.2, with the change suggested
|
|
|
|
// (making A2 a virtual base of V1)
|
|
|
|
namespace Test4 {
|
|
|
|
class A1 { int i; };
|
|
|
|
class A2 { int i; virtual void f(); };
|
|
|
|
class V1 : public A1, public virtual A2 { int i; };
|
|
|
|
class B1 { int i; };
|
|
|
|
class B2 { int i; };
|
|
|
|
class V2 : public B1, public B2, public virtual V1 { int i; };
|
|
|
|
class V3 {virtual void g(); };
|
|
|
|
class C1 : public virtual V1 { int i; };
|
|
|
|
class C2 : public virtual V3, virtual V2 { int i; };
|
|
|
|
class X1 { int i; };
|
|
|
|
class C3 : public X1 { int i; };
|
|
|
|
class D : public C1, public C2, public C3 { int i; };
|
|
|
|
|
|
|
|
D d;
|
|
|
|
}
|
|
|
|
|
2012-10-17 05:03:19 +08:00
|
|
|
namespace Test5 {
|
|
|
|
struct A {
|
|
|
|
virtual void f() = 0;
|
|
|
|
virtual void anchor();
|
|
|
|
};
|
|
|
|
|
|
|
|
void A::anchor() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-17 06:56:05 +08:00
|
|
|
namespace Test6 {
|
|
|
|
struct A {
|
|
|
|
virtual void f() = delete;
|
|
|
|
virtual void anchor();
|
|
|
|
};
|
|
|
|
|
|
|
|
void A::anchor() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-12 06:29:55 +08:00
|
|
|
// CHECK: @_ZTTN5Test11BE = unnamed_addr constant [1 x i8*] [i8* bitcast (i8** getelementptr inbounds ([4 x i8*]* @_ZTVN5Test11BE, i64 0, i64 3) to i8*)]
|
2012-10-17 05:03:19 +08:00
|
|
|
// CHECK: @_ZTVN5Test51AE = unnamed_addr constant [4 x i8*] [i8* null, i8* bitcast ({ i8*, i8* }* @_ZTIN5Test51AE to i8*), i8* bitcast (void ()* @__cxa_pure_virtual to i8*), i8* bitcast (void (%"struct.Test5::A"*)* @_ZN5Test51A6anchorEv to i8*)]
|
2012-10-17 06:56:05 +08:00
|
|
|
// CHECK: @_ZTVN5Test61AE = unnamed_addr constant [4 x i8*] [i8* null, i8* bitcast ({ i8*, i8* }* @_ZTIN5Test61AE to i8*), i8* bitcast (void ()* @__cxa_deleted_virtual to i8*), i8* bitcast (void (%"struct.Test6::A"*)* @_ZN5Test61A6anchorEv to i8*)]
|
2011-01-24 08:46:19 +08:00
|
|
|
// CHECK: @_ZTTN5Test21CE = linkonce_odr unnamed_addr constant [2 x i8*] [i8* bitcast (i8** getelementptr inbounds ([5 x i8*]* @_ZTVN5Test21CE, i64 0, i64 4) to i8*), i8* bitcast (i8** getelementptr inbounds ([5 x i8*]* @_ZTVN5Test21CE, i64 0, i64 4) to i8*)]
|
2015-01-22 08:24:57 +08:00
|
|
|
// CHECK: @_ZTTN5Test31DE = linkonce_odr unnamed_addr constant [13 x i8*] [i8* bitcast (i8** getelementptr inbounds ([19 x i8*]* @_ZTVN5Test31DE, i64 0, i64 5) to i8*), i8* bitcast (i8** getelementptr inbounds ([7 x i8*]* @_ZTCN5Test31DE0_NS_2C1E, i64 0, i64 3) to i8*), i8* bitcast (i8** getelementptr inbounds ([7 x i8*]* @_ZTCN5Test31DE0_NS_2C1E, i64 0, i64 6) to i8*), i8* bitcast (i8** getelementptr inbounds ([14 x i8*]* @_ZTCN5Test31DE16_NS_2C2E, i64 0, i64 6) to i8*), i8* bitcast (i8** getelementptr inbounds ([14 x i8*]* @_ZTCN5Test31DE16_NS_2C2E, i64 0, i64 6) to i8*), i8* bitcast (i8** getelementptr inbounds ([14 x i8*]* @_ZTCN5Test31DE16_NS_2C2E, i64 0, i64 10) to i8*), i8* bitcast (i8** getelementptr inbounds ([14 x i8*]* @_ZTCN5Test31DE16_NS_2C2E, i64 0, i64 13) to i8*), i8* bitcast (i8** getelementptr inbounds ([19 x i8*]* @_ZTVN5Test31DE, i64 0, i64 15) to i8*), i8* bitcast (i8** getelementptr inbounds ([19 x i8*]* @_ZTVN5Test31DE, i64 0, i64 11) to i8*), i8* bitcast (i8** getelementptr inbounds ([19 x i8*]* @_ZTVN5Test31DE, i64 0, i64 11) to i8*), i8* bitcast (i8** getelementptr inbounds ([19 x i8*]* @_ZTVN5Test31DE, i64 1, i64 0) to i8*), i8* bitcast (i8** getelementptr inbounds ([7 x i8*]* @_ZTCN5Test31DE64_NS_2V2E, i64 0, i64 3) to i8*), i8* bitcast (i8** getelementptr inbounds ([7 x i8*]* @_ZTCN5Test31DE64_NS_2V2E, i64 0, i64 6) to i8*)]
|
|
|
|
// CHECK: @_ZTTN5Test41DE = linkonce_odr unnamed_addr constant [19 x i8*] [i8* bitcast (i8** getelementptr inbounds ([25 x i8*]* @_ZTVN5Test41DE, i64 0, i64 6) to i8*), i8* bitcast (i8** getelementptr inbounds ([11 x i8*]* @_ZTCN5Test41DE0_NS_2C1E, i64 0, i64 4) to i8*), i8* bitcast (i8** getelementptr inbounds ([11 x i8*]* @_ZTCN5Test41DE0_NS_2C1E, i64 0, i64 7) to i8*), i8* bitcast (i8** getelementptr inbounds ([11 x i8*]* @_ZTCN5Test41DE0_NS_2C1E, i64 0, i64 10) to i8*), i8* bitcast (i8** getelementptr inbounds ([19 x i8*]* @_ZTCN5Test41DE16_NS_2C2E, i64 0, i64 7) to i8*), i8* bitcast (i8** getelementptr inbounds ([19 x i8*]* @_ZTCN5Test41DE16_NS_2C2E, i64 0, i64 7) to i8*), i8* bitcast (i8** getelementptr inbounds ([19 x i8*]* @_ZTCN5Test41DE16_NS_2C2E, i64 0, i64 12) to i8*), i8* bitcast (i8** getelementptr inbounds ([19 x i8*]* @_ZTCN5Test41DE16_NS_2C2E, i64 0, i64 15) to i8*), i8* bitcast (i8** getelementptr inbounds ([19 x i8*]* @_ZTCN5Test41DE16_NS_2C2E, i64 0, i64 18) to i8*), i8* bitcast (i8** getelementptr inbounds ([25 x i8*]* @_ZTVN5Test41DE, i64 0, i64 17) to i8*), i8* bitcast (i8** getelementptr inbounds ([25 x i8*]* @_ZTVN5Test41DE, i64 0, i64 20) to i8*), i8* bitcast (i8** getelementptr inbounds ([25 x i8*]* @_ZTVN5Test41DE, i64 0, i64 13) to i8*), i8* bitcast (i8** getelementptr inbounds ([25 x i8*]* @_ZTVN5Test41DE, i64 0, i64 13) to i8*), i8* bitcast (i8** getelementptr inbounds ([25 x i8*]* @_ZTVN5Test41DE, i64 1, i64 0) to i8*), i8* bitcast (i8** getelementptr inbounds ([7 x i8*]* @_ZTCN5Test41DE40_NS_2V1E, i64 0, i64 3) to i8*), i8* bitcast (i8** getelementptr inbounds ([7 x i8*]* @_ZTCN5Test41DE40_NS_2V1E, i64 0, i64 6) to i8*), i8* bitcast (i8** getelementptr inbounds ([11 x i8*]* @_ZTCN5Test41DE72_NS_2V2E, i64 0, i64 4) to i8*), i8* bitcast (i8** getelementptr inbounds ([11 x i8*]* @_ZTCN5Test41DE72_NS_2V2E, i64 0, i64 7) to i8*), i8* bitcast (i8** getelementptr inbounds ([11 x i8*]* @_ZTCN5Test41DE72_NS_2V2E, i64 0, i64 10) to i8*)]
|