Set dso_local on vtables.

llvm-svn: 328238
This commit is contained in:
Rafael Espindola 2018-03-22 20:33:01 +00:00
parent 2ecb7ba4c6
commit e006b8f486
2 changed files with 5 additions and 2 deletions

View File

@ -2848,6 +2848,7 @@ void ItaniumRTTIBuilder::BuildVTablePointer(const Type *Ty) {
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::BuildVTablePointer(const Type *Ty) {
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::BuildVTablePointer(const Type *Ty) {
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());

View File

@ -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