aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGVTT.cpp
diff options
context:
space:
mode:
authorRoman Divacky <rdivacky@FreeBSD.org>2010-03-03 17:28:16 +0000
committerRoman Divacky <rdivacky@FreeBSD.org>2010-03-03 17:28:16 +0000
commit79ade4e028932fcb9dab15e2fb2305ca15ab0f14 (patch)
treee1a885aadfd80632f5bd70d4bd2d37e715e35a79 /lib/CodeGen/CGVTT.cpp
parentecb7e5c8afe929ee38155db94de6b084ec32a645 (diff)
downloadsrc-79ade4e028932fcb9dab15e2fb2305ca15ab0f14.tar.gz
src-79ade4e028932fcb9dab15e2fb2305ca15ab0f14.zip
Notes
Diffstat (limited to 'lib/CodeGen/CGVTT.cpp')
-rw-r--r--lib/CodeGen/CGVTT.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/CodeGen/CGVTT.cpp b/lib/CodeGen/CGVTT.cpp
index 9714bd9d9678..96c104b22d15 100644
--- a/lib/CodeGen/CGVTT.cpp
+++ b/lib/CodeGen/CGVTT.cpp
@@ -46,7 +46,8 @@ class VTTBuilder {
llvm::DenseMap<std::pair<const CXXRecordDecl *, BaseSubobject>, uint64_t>
CtorVtableAddressPoints;
- llvm::Constant *getCtorVtable(const BaseSubobject &Base) {
+ llvm::Constant *getCtorVtable(const BaseSubobject &Base,
+ bool BaseIsVirtual) {
if (!GenerateDefinition)
return 0;
@@ -54,7 +55,7 @@ class VTTBuilder {
if (!CtorVtable) {
// Build the vtable.
CGVtableInfo::CtorVtableInfo Info
- = CGM.getVtableInfo().getCtorVtable(Class, Base);
+ = CGM.getVtableInfo().getCtorVtable(Class, Base, BaseIsVirtual);
CtorVtable = Info.Vtable;
@@ -166,7 +167,7 @@ class VTTBuilder {
if (BaseMorallyVirtual || VtblClass == Class)
init = BuildVtablePtr(vtbl, VtblClass, Base, BaseOffset);
else {
- init = getCtorVtable(BaseSubobject(Base, BaseOffset));
+ init = getCtorVtable(BaseSubobject(Base, BaseOffset), i->isVirtual());
subvtbl = init;
subVtblClass = Base;
@@ -186,7 +187,8 @@ class VTTBuilder {
/// BuiltVTT - Add the VTT to Inits. Offset is the offset in bits to the
/// currnet object we're working on.
- void BuildVTT(const CXXRecordDecl *RD, uint64_t Offset, bool MorallyVirtual) {
+ void BuildVTT(const CXXRecordDecl *RD, uint64_t Offset, bool BaseIsVirtual,
+ bool MorallyVirtual) {
// Itanium C++ ABI 2.6.2:
// An array of virtual table addresses, called the VTT, is declared for
// each class type that has indirect or direct virtual base classes.
@@ -204,7 +206,8 @@ class VTTBuilder {
Vtable = ClassVtbl;
VtableClass = Class;
} else {
- Vtable = getCtorVtable(BaseSubobject(RD, Offset));
+ Vtable = getCtorVtable(BaseSubobject(RD, Offset),
+ /*IsVirtual=*/BaseIsVirtual);
VtableClass = RD;
}
@@ -235,7 +238,7 @@ class VTTBuilder {
const ASTRecordLayout &Layout = CGM.getContext().getASTRecordLayout(RD);
uint64_t BaseOffset = Offset + Layout.getBaseClassOffset(Base);
- BuildVTT(Base, BaseOffset, MorallyVirtual);
+ BuildVTT(Base, BaseOffset, /*BaseIsVirtual=*/false, MorallyVirtual);
}
}
@@ -249,7 +252,7 @@ class VTTBuilder {
if (i->isVirtual() && !SeenVBase.count(Base)) {
SeenVBase.insert(Base);
uint64_t BaseOffset = BLayout.getVBaseClassOffset(Base);
- BuildVTT(Base, BaseOffset, false);
+ BuildVTT(Base, BaseOffset, /*BaseIsVirtual=*/true, false);
}
VirtualVTTs(Base);
}
@@ -335,13 +338,13 @@ CGVtableInfo::GenerateVTT(llvm::GlobalVariable::LinkageTypes Linkage,
CGVtableInfo::CtorVtableInfo
CGVtableInfo::getCtorVtable(const CXXRecordDecl *RD,
- const BaseSubobject &Base) {
+ const BaseSubobject &Base, bool BaseIsVirtual) {
CtorVtableInfo Info;
Info.Vtable = GenerateVtable(llvm::GlobalValue::InternalLinkage,
/*GenerateDefinition=*/true,
RD, Base.getBase(), Base.getBaseOffset(),
- Info.AddressPoints);
+ BaseIsVirtual, Info.AddressPoints);
return Info;
}