[cfe-commits] r99612 - /cfe/trunk/lib/CodeGen/CGClass.cpp

Anders Carlsson andersca at mac.com
Thu Mar 25 22:53:13 PDT 2010


Author: andersca
Date: Fri Mar 26 00:53:12 2010
New Revision: 99612

URL: http://llvm.org/viewvc/llvm-project?rev=99612&view=rev
Log:
Don't initialize virtual pointers for primary bases, they've already been initialized.

Modified:
    cfe/trunk/lib/CodeGen/CGClass.cpp

Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=99612&r1=99611&r2=99612&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGClass.cpp Fri Mar 26 00:53:12 2010
@@ -1601,6 +1601,13 @@
     
     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);
     





More information about the cfe-commits mailing list