]> granicus.if.org Git - clang/commitdiff
Don't initialize virtual pointers for primary bases, they've already been initialized.
authorAnders Carlsson <andersca@mac.com>
Fri, 26 Mar 2010 05:53:12 +0000 (05:53 +0000)
committerAnders Carlsson <andersca@mac.com>
Fri, 26 Mar 2010 05:53:12 +0000 (05:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99612 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGClass.cpp

index 8a084926e76a5df0e07b6a7d4ca8b47205b4942e..4999d620b5e1f279cd34eff687db2c660bcca356 100644 (file)
@@ -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);