aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGVtable.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-03-10 19:39:11 +0000
committerAnders Carlsson <andersca@mac.com>2010-03-10 19:39:11 +0000
commita96a2e961a3bce0ad2fc44a115ac949a481d42db (patch)
treea12a9291c77bd7fff9a215e4b485c665f6f38187 /lib/CodeGen/CGVtable.cpp
parentf2c98ce9819cb7688a86e308f82ee896694a10e5 (diff)
We were mistakenly marking morally virtual bases as being uninteresting. Fix this.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98180 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGVtable.cpp')
-rw-r--r--lib/CodeGen/CGVtable.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/CodeGen/CGVtable.cpp b/lib/CodeGen/CGVtable.cpp
index caf1e1f93e..37dd23c0b5 100644
--- a/lib/CodeGen/CGVtable.cpp
+++ b/lib/CodeGen/CGVtable.cpp
@@ -1235,7 +1235,11 @@ private:
/// LayoutSecondaryVtables - Layout the secondary vtables for the given base
/// subobject.
- void LayoutSecondaryVtables(BaseSubobject Base, uint64_t OffsetInLayoutClass);
+ ///
+ /// \param BaseIsMorallyVirtual whether the base subobject is a virtual base
+ /// or a direct or indirect base of a virtual base.
+ void LayoutSecondaryVtables(BaseSubobject Base, bool BaseIsMorallyVirtual,
+ uint64_t OffsetInLayoutClass);
/// DeterminePrimaryVirtualBases - Determine the primary virtual bases in this
/// class hierarchy.
@@ -1772,11 +1776,16 @@ VtableBuilder::LayoutPrimaryAndSecondaryVtables(BaseSubobject Base,
AddressPoints.insert(std::make_pair(PrimaryBase, AddressPoint));
}
+ bool BaseIsMorallyVirtual = BaseIsVirtual;
+ if (isBuildingConstructorVtable() && Base.getBase() == MostDerivedClass)
+ BaseIsMorallyVirtual = false;
+
// Layout secondary vtables.
- LayoutSecondaryVtables(Base, OffsetInLayoutClass);
+ LayoutSecondaryVtables(Base, BaseIsMorallyVirtual, OffsetInLayoutClass);
}
void VtableBuilder::LayoutSecondaryVtables(BaseSubobject Base,
+ bool BaseIsMorallyVirtual,
uint64_t OffsetInLayoutClass) {
// Itanium C++ ABI 2.5.2:
// Following the primary virtual table of a derived class are secondary
@@ -1806,9 +1815,8 @@ void VtableBuilder::LayoutSecondaryVtables(BaseSubobject Base,
// tables, which will therefore not be present in the construction
// virtual table group, even though the subobject virtual tables are
// present in the main virtual table group for the complete object.
- if (!BaseDecl->getNumVBases()) {
+ if (!BaseIsMorallyVirtual && !BaseDecl->getNumVBases())
continue;
- }
}
// Get the base offset of this base.
@@ -1821,7 +1829,7 @@ void VtableBuilder::LayoutSecondaryVtables(BaseSubobject Base,
// to emit secondary vtables for other bases of this base.
if (BaseDecl == PrimaryBase) {
LayoutSecondaryVtables(BaseSubobject(BaseDecl, BaseOffset),
- BaseOffsetInLayoutClass);
+ BaseIsMorallyVirtual, BaseOffsetInLayoutClass);
continue;
}