Improve LLVM symbol name clash detection for classes

This commit is contained in:
Svyatoslav Scherbina
2018-03-21 11:09:17 +03:00
committed by SvyatoslavScherbina
parent bcf1722ecd
commit 226a97bbf6
@@ -247,7 +247,12 @@ private class DeclarationsGeneratorVisitor(override val context: Context) :
typeInfoGlobal.pointer.getElementPtr(0).llvm,
typeInfoSymbolName)!!
if (!descriptor.isExported()) {
if (descriptor.isExported()) {
if (llvmTypeInfoPtr.name != typeInfoSymbolName) {
// So alias name has been mangled by LLVM to avoid name clash.
throw IllegalArgumentException("Global '$typeInfoSymbolName' already exists")
}
} else {
LLVMSetLinkage(llvmTypeInfoPtr, LLVMLinkage.LLVMInternalLinkage)
}