r260238 - [MS ABI] Cleanup emitVTableDefinitions

David Majnemer via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 9 09:27:52 PST 2016


Author: majnemer
Date: Tue Feb  9 11:27:52 2016
New Revision: 260238

URL: http://llvm.org/viewvc/llvm-project?rev=260238&view=rev
Log:
[MS ABI] Cleanup emitVTableDefinitions

Use the VFTable components to determine whether or not we should emit
RTTI data instead of duplicating the VFTableBuilder's logic.

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

Modified: cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp?rev=260238&r1=260237&r2=260238&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp (original)
+++ cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp Tue Feb  9 11:27:52 2016
@@ -1567,14 +1567,14 @@ void MicrosoftCXXABI::emitVTableDefiniti
     if (VTable->hasInitializer())
       continue;
 
-    llvm::Constant *RTTI = getContext().getLangOpts().RTTIData &&
-                                   VTable->getDLLStorageClass() !=
-                                       llvm::GlobalValue::DLLImportStorageClass
-                               ? getMSCompleteObjectLocator(RD, Info)
-                               : nullptr;
-
     const VTableLayout &VTLayout =
       VFTContext.getVFTableLayout(RD, Info->FullOffsetInMDC);
+
+    llvm::Constant *RTTI = nullptr;
+    if (any_of(VTLayout.vtable_components(),
+               [](const VTableComponent &VTC) { return VTC.isRTTIKind(); }))
+      RTTI = getMSCompleteObjectLocator(RD, Info);
+
     llvm::Constant *Init = CGVT.CreateVTableInitializer(
         RD, VTLayout.vtable_component_begin(),
         VTLayout.getNumVTableComponents(), VTLayout.vtable_thunk_begin(),




More information about the cfe-commits mailing list