From: Mike Stump Date: Fri, 13 Nov 2009 02:35:38 +0000 (+0000) Subject: Refine construction vtables; they don't include bits that don't have X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=92774d1051f5315052fd63d39673c42c9c03a1c4;p=clang Refine construction vtables; they don't include bits that don't have virtual bases unless they are morally virtual. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87071 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGVtable.cpp b/lib/CodeGen/CGVtable.cpp index 9f45343d6b..b12a48ad94 100644 --- a/lib/CodeGen/CGVtable.cpp +++ b/lib/CodeGen/CGVtable.cpp @@ -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();