Fixed bug with name clash for package level properties
This commit is contained in:
+4
-3
@@ -287,13 +287,14 @@ private class DeclarationsGeneratorVisitor(override val context: Context) :
|
||||
return null
|
||||
}
|
||||
|
||||
val symbolName = if (descriptor.isExported()) {
|
||||
val isExported = descriptor.isExported()
|
||||
val symbolName = if (isExported) {
|
||||
descriptor.objectInstanceFieldSymbolName
|
||||
} else {
|
||||
"kobjref:" + qualifyInternalName(descriptor)
|
||||
}
|
||||
val instanceFieldRef = addGlobal(
|
||||
symbolName, getLLVMType(descriptor.defaultType), threadLocal = true)
|
||||
symbolName, getLLVMType(descriptor.defaultType), isExported = isExported, threadLocal = true)
|
||||
|
||||
return SingletonLlvmDeclarations(instanceFieldRef)
|
||||
}
|
||||
@@ -320,7 +321,7 @@ private class DeclarationsGeneratorVisitor(override val context: Context) :
|
||||
val name = "kvar:" + qualifyInternalName(descriptor)
|
||||
|
||||
val storage = addGlobal(
|
||||
name, getLLVMType(descriptor.type), threadLocal = true)
|
||||
name, getLLVMType(descriptor.type), isExported = false, threadLocal = true)
|
||||
|
||||
this.staticFields[descriptor] = StaticFieldLlvmDeclarations(storage)
|
||||
}
|
||||
|
||||
+3
-2
@@ -182,9 +182,10 @@ internal fun getGlobalType(ptrToGlobal: LLVMValueRef): LLVMTypeRef {
|
||||
return LLVMGetElementType(ptrToGlobal.type)!!
|
||||
}
|
||||
|
||||
internal fun ContextUtils.addGlobal(name: String, type: LLVMTypeRef,
|
||||
internal fun ContextUtils.addGlobal(name: String, type: LLVMTypeRef, isExported: Boolean,
|
||||
threadLocal: Boolean = false): LLVMValueRef {
|
||||
assert(LLVMGetNamedGlobal(context.llvmModule, name) == null)
|
||||
if (isExported)
|
||||
assert(LLVMGetNamedGlobal(context.llvmModule, name) == null)
|
||||
val result = LLVMAddGlobal(context.llvmModule, type, name)!!
|
||||
if (threadLocal)
|
||||
LLVMSetThreadLocalMode(result, runtime.tlsMode)
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ internal class RTTIGenerator(override val context: Context) : ContextUtils {
|
||||
if (annot != null) {
|
||||
val nameValue = annot.allValueArguments.values.single() as StringValue
|
||||
// TODO: use LLVMAddAlias?
|
||||
val global = addGlobal(nameValue.value, pointerType(runtime.typeInfoType))
|
||||
val global = addGlobal(nameValue.value, pointerType(runtime.typeInfoType), isExported = true)
|
||||
LLVMSetInitializer(global, typeInfoGlobal)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user