From c2d526e4b2fa1cda43e614d80c9fc156f2874996 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Fri, 26 Mar 2010 05:53:12 +0000 Subject: [PATCH] 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 --- lib/CodeGen/CGClass.cpp | 7 +++++++ 1 file changed, 7 insertions(+) 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(I->getType()->getAs()->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); -- 2.40.0