diff options
author | Anders Carlsson <andersca@mac.com> | 2010-03-26 05:53:12 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2010-03-26 05:53:12 +0000 |
commit | c2d526e4b2fa1cda43e614d80c9fc156f2874996 (patch) | |
tree | 63a045d44f8a1694ed4c2890b8f77aa69c1ffda9 /lib/CodeGen/CGClass.cpp | |
parent | 9d0e441036de0faa59d8039ce0c9967bda112c7f (diff) |
Don't initialize virtual pointers for primary bases, they've already been initialized.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99612 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGClass.cpp')
-rw-r--r-- | lib/CodeGen/CGClass.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/CodeGen/CGClass.cpp b/lib/CodeGen/CGClass.cpp index 8a084926e7..4999d620b5 100644 --- a/lib/CodeGen/CGClass.cpp +++ b/lib/CodeGen/CGClass.cpp @@ -1601,6 +1601,13 @@ void CodeGenFunction::InitializeVtablePtrs(BaseSubobject Base, CXXRecordDecl *BaseDecl = cast<CXXRecordDecl>(I->getType()->getAs<RecordType>()->getDecl()); + + // We don't need to initialize vtable pointers for primary bases, unless + // they're virtual. + if (!Layout.getPrimaryBaseWasVirtual() && + Layout.getPrimaryBase() == BaseDecl) + continue; + uint64_t BaseOffset = Base.getBaseOffset() + Layout.getBaseClassOffset(BaseDecl); |