aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGVtable.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-02-28 18:08:38 +0000
committerAnders Carlsson <andersca@mac.com>2010-02-28 18:08:38 +0000
commit0378bf0840335c6d56b2f1b51079522054f7da4f (patch)
treebef3cddcd50845f05c452efee3e18a515d6731d8 /lib/CodeGen/CGVtable.cpp
parent293126becf78ef56bfaa446385af8a368eb8d1c2 (diff)
When laying out vtables for virtual bases in construction vtables, we need to check if the vtable is a primary base in the layout class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97402 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGVtable.cpp')
-rw-r--r--lib/CodeGen/CGVtable.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/CodeGen/CGVtable.cpp b/lib/CodeGen/CGVtable.cpp
index 4f3cdde2d8..40a7b2f180 100644
--- a/lib/CodeGen/CGVtable.cpp
+++ b/lib/CodeGen/CGVtable.cpp
@@ -1799,9 +1799,22 @@ VtableBuilder::DeterminePrimaryVirtualBases(const CXXRecordDecl *RD,
// Check if this base has a primary base.
if (const CXXRecordDecl *PrimaryBase = Layout.getPrimaryBase()) {
- // Check if it's virtual
- if (Layout.getPrimaryBaseWasVirtual())
- PrimaryVirtualBases.insert(PrimaryBase);
+
+ // Check if it's virtual.
+ if (Layout.getPrimaryBaseWasVirtual()) {
+ bool IsPrimaryVirtualBase = true;
+
+ if (isBuildingConstructorVtable()) {
+ // Check if the base is actually a primary base in the class we use for
+ // layout.
+ // FIXME: Is this check enough?
+ if (MostDerivedClassOffset != 0)
+ IsPrimaryVirtualBase = false;
+ }
+
+ if (IsPrimaryVirtualBase)
+ PrimaryVirtualBases.insert(PrimaryBase);
+ }
}
// Traverse bases, looking for more primary virtual bases.