diff options
| author | Anders Carlsson <andersca@mac.com> | 2010-02-28 18:08:38 +0000 |
|---|---|---|
| committer | Anders Carlsson <andersca@mac.com> | 2010-02-28 18:08:38 +0000 |
| commit | 8b37bb7c48a6033f027231c029ec96766d0f193a (patch) | |
| tree | c74e9c8481c738651b87a273e0a9aa6f7b382012 /clang/lib/CodeGen | |
| parent | b15d8c57adb89766b20ec15e6b2ea6fdad104534 (diff) | |
| download | bcm5719-llvm-8b37bb7c48a6033f027231c029ec96766d0f193a.tar.gz bcm5719-llvm-8b37bb7c48a6033f027231c029ec96766d0f193a.zip | |
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.
llvm-svn: 97402
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/CGVtable.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGVtable.cpp b/clang/lib/CodeGen/CGVtable.cpp index 4f3cdde2d8f..40a7b2f180e 100644 --- a/clang/lib/CodeGen/CGVtable.cpp +++ b/clang/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. |

