]> granicus.if.org Git - clang/commitdiff
Refine construction vtables; they don't include bits that don't have
authorMike Stump <mrs@apple.com>
Fri, 13 Nov 2009 02:35:38 +0000 (02:35 +0000)
committerMike Stump <mrs@apple.com>
Fri, 13 Nov 2009 02:35:38 +0000 (02:35 +0000)
virtual bases unless they are morally virtual.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87071 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGVtable.cpp

index 9f45343d6be15cb84f80d8dc8d4adbb495d9df0d..b12a48ad94bf01b804246d5d222058380925383c 100644 (file)
@@ -585,6 +585,11 @@ public:
     if (!RD->isDynamicClass())
       return 0;
 
+    // Construction vtable don't need parts that have no virtual bases and
+    // aren't morally virtual.
+    if ((LayoutClass != Class) && RD->getNumVBases() == 0 && !MorallyVirtual)
+      return 0;
+
     const ASTRecordLayout &Layout = CGM.getContext().getASTRecordLayout(RD);
     const CXXRecordDecl *PrimaryBase = Layout.getPrimaryBase();
     const bool PrimaryBaseWasVirtual = Layout.getPrimaryBaseWasVirtual();