r328238 - Set dso_local on vtables.

Rafael Espindola via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 22 13:33:02 PDT 2018


Author: rafael
Date: Thu Mar 22 13:33:01 2018
New Revision: 328238

URL: http://llvm.org/viewvc/llvm-project?rev=328238&view=rev
Log:
Set dso_local on vtables.

Modified:
    cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
    cfe/trunk/test/CodeGenCXX/dllexport.cpp

Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=328238&r1=328237&r2=328238&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp (original)
+++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp Thu Mar 22 13:33:01 2018
@@ -2848,6 +2848,7 @@ void ItaniumRTTIBuilder::BuildVTablePoin
 
   const char *VTableName = nullptr;
 
+  const CXXRecordDecl *RD = nullptr;
   switch (Ty->getTypeClass()) {
 #define TYPE(Class, Base)
 #define ABSTRACT_TYPE(Class, Base)
@@ -2899,8 +2900,7 @@ void ItaniumRTTIBuilder::BuildVTablePoin
     break;
 
   case Type::Record: {
-    const CXXRecordDecl *RD =
-      cast<CXXRecordDecl>(cast<RecordType>(Ty)->getDecl());
+    RD = cast<CXXRecordDecl>(cast<RecordType>(Ty)->getDecl());
 
     if (!RD->hasDefinition() || !RD->getNumBases()) {
       VTableName = ClassTypeInfo;
@@ -2948,6 +2948,7 @@ void ItaniumRTTIBuilder::BuildVTablePoin
 
   llvm::Constant *VTable =
     CGM.getModule().getOrInsertGlobal(VTableName, CGM.Int8PtrTy);
+  CGM.setGVProperties(cast<llvm::GlobalValue>(VTable->stripPointerCasts()), RD);
 
   llvm::Type *PtrDiffTy =
     CGM.getTypes().ConvertType(CGM.getContext().getPointerDiffType());

Modified: cfe/trunk/test/CodeGenCXX/dllexport.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/dllexport.cpp?rev=328238&r1=328237&r2=328238&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/dllexport.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/dllexport.cpp Thu Mar 22 13:33:01 2018
@@ -41,6 +41,8 @@ struct External { int v; };
 // GNU-NOT: @ExternGlobalDecl
 __declspec(dllexport) extern int ExternGlobalDecl;
 
+// GNU-DAG: @_ZTVN10__cxxabiv117__class_type_infoE = external dso_local global
+
 // dllexport implies a definition.
 // MSC-DAG: @"?GlobalDef@@3HA" = dso_local dllexport global i32 0, align 4
 // GNU-DAG: @GlobalDef            = dso_local dllexport global i32 0, align 4




More information about the cfe-commits mailing list