Fix @Retain annotation behavior. (#2068)
This commit is contained in:
@@ -25,10 +25,8 @@ typealias Object = Int
|
||||
typealias Pointer = Int
|
||||
|
||||
/**
|
||||
* Used annotation is required to preserve functions
|
||||
* from internalization and DCE
|
||||
* @Retain annotation is required to preserve functions from internalization and DCE.
|
||||
*/
|
||||
|
||||
@Retain
|
||||
@SymbolName("Konan_js_allocateArena")
|
||||
external public fun allocateArena(): Arena
|
||||
|
||||
+1
-1
@@ -738,7 +738,7 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map<IrE
|
||||
}
|
||||
|
||||
|
||||
if (declaration.descriptor.usedAnnotation) {
|
||||
if (declaration.descriptor.retainAnnotation) {
|
||||
context.llvm.usedFunctions.add(codegen.llvmFunction(declaration))
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -9,9 +9,9 @@ import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.*
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
|
||||
private val annotationName = FqName("kotlin.native.Used")
|
||||
private val annotationName = FqName("kotlin.native.Retain")
|
||||
|
||||
internal val FunctionDescriptor.usedAnnotation: Boolean
|
||||
internal val FunctionDescriptor.retainAnnotation: Boolean
|
||||
get() {
|
||||
return (this.annotations.findAnnotation(annotationName) != null)
|
||||
}
|
||||
Reference in New Issue
Block a user