MSVC: Emit EH type descriptors as COMDATs

This commit is contained in:
Martin 2018-04-07 20:07:20 +02:00
parent f38a7972a5
commit 9079e5cbed

View file

@ -187,9 +187,13 @@ llvm::GlobalVariable *getTypeDescriptor(IRState &irs, ClassDeclaration *cd) {
llvm::ConstantDataArray::getString(gIR->context(), TypeNameString)};
llvm::StructType *TypeDescriptorType =
getTypeDescriptorType(irs, classInfoPtr, TypeNameString);
const LinkageWithCOMDAT lwc = {LLGlobalVariable::LinkOnceODRLinkage, true};
Var = defineGlobal(cd->loc, gIR->module, TypeDescName,
llvm::ConstantStruct::get(TypeDescriptorType, Fields),
LLGlobalVariable::InternalLinkage, false);
lwc.first, /*isConstant=*/true);
setLinkage(lwc, Var);
return Var;
}