[IR, Native] Support partial linkage in backend
^KT-50775
This commit is contained in:
+1
@@ -232,6 +232,7 @@ internal class KonanSymbols(
|
||||
override val throwNullPointerException = internalFunction("ThrowNullPointerException")
|
||||
|
||||
val throwNoWhenBranchMatchedException = internalFunction("ThrowNoWhenBranchMatchedException")
|
||||
val throwIrLinkageError = internalFunction("ThrowIrLinkageError")
|
||||
|
||||
override val throwTypeCastException = internalFunction("ThrowTypeCastException")
|
||||
|
||||
|
||||
+9
@@ -57,6 +57,15 @@ internal class BuiltinOperatorLowering(val context: Context) : FileLoweringPass,
|
||||
context.ir.symbols.throwNoWhenBranchMatchedException.owner.typeParameters.size,
|
||||
context.ir.symbols.throwNoWhenBranchMatchedException.owner.valueParameters.size)
|
||||
|
||||
irBuiltins.linkageErrorSymbol -> {
|
||||
val newExpression = IrCallImpl.fromSymbolOwner(
|
||||
expression.startOffset, expression.endOffset,
|
||||
context.ir.symbols.throwIrLinkageError
|
||||
)
|
||||
newExpression.putValueArgument(0, expression.getValueArgument(0)) // error message
|
||||
newExpression
|
||||
}
|
||||
|
||||
else -> expression
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,6 +112,13 @@ internal fun ThrowFileFailedToInitializeException() {
|
||||
throw FileFailedToInitializeException("There was an error during file initialization")
|
||||
}
|
||||
|
||||
internal class IrLinkageError(message: String?) : Error(message)
|
||||
|
||||
@PublishedApi
|
||||
internal fun ThrowIrLinkageError(message: String?): Nothing {
|
||||
throw IrLinkageError(message)
|
||||
}
|
||||
|
||||
@ExportForCppRuntime
|
||||
internal fun PrintThrowable(throwable: Throwable) {
|
||||
println(throwable)
|
||||
|
||||
Reference in New Issue
Block a user