Moved a couple more Konan specific annotations to "konan" package

This commit is contained in:
Alexander Gorshenev
2016-11-30 15:38:24 +03:00
committed by alexander-gorshenev
parent b2983850b6
commit 95433e8a82
5 changed files with 25 additions and 24 deletions
@@ -12,7 +12,7 @@ import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.TypeUtils
private val symbolNameAnnotation = FqName("kotlin.SymbolName")
private val symbolNameAnnotation = FqName("konan.SymbolName")
fun typeToHashString(type: KotlinType): String {
if (TypeUtils.isTypeParameter(type)) return "GENERIC"
@@ -76,4 +76,4 @@ internal val ClassDescriptor.typeInfoSymbolName: String
get() = "ktype:" + this.fqNameSafe.toString()
internal val PropertyDescriptor.symbolName:String
get() = "kvar:${this.containingDeclaration.name.asString()}.${this.name.asString()}"
get() = "kvar:${this.containingDeclaration.name.asString()}.${this.name.asString()}"
@@ -111,7 +111,7 @@ internal class RTTIGenerator(override val context: Context) : ContextUtils {
}
private fun exportTypeInfoIfRequired(classDesc: ClassDescriptor, typeInfoGlobal: LLVMValueRef?) {
val annot = classDesc.annotations.findAnnotation(FqName("kotlin.ExportTypeInfo"))
val annot = classDesc.annotations.findAnnotation(FqName("konan.ExportTypeInfo"))
if (annot != null) {
val nameValue = annot.allValueArguments.values.single() as StringValue
// TODO: use LLVMAddAlias?
@@ -1,5 +1,23 @@
package konan
/**
* Forces the compiler to use specified symbol name for the target `external` function.
*
* TODO: changing symbol name breaks the binary compatibility,
* so it should probably be allowed on `internal` and `private` functions only.
*/
//@Target(AnnotationTarget.FUNCTION)
//@Retention(AnnotationRetention.SOURCE)
annotation class SymbolName(val name: String)
/**
* Exports the TypeInfo of this class by given name to use it from runtime.
*/
//@Target(AnnotationTarget.CLASS)
//@Retention(AnnotationRetention.SOURCE)
annotation class ExportTypeInfo(val name: String)
/**
* Preserve the function entry point during global optimizations
*/
@@ -2,23 +2,6 @@ package kotlin
// TODO: shouldn't these annotation be located in 'kotlin_native.internal' package?
/**
* Forces the compiler to use specified symbol name for the target `external` function.
*
* TODO: changing symbol name breaks the binary compatibility,
* so it should probably be allowed on `internal` and `private` functions only.
*/
//@Target(AnnotationTarget.FUNCTION)
//@Retention(AnnotationRetention.SOURCE)
annotation class SymbolName(val name: String)
/**
* Exports the TypeInfo of this class by given name to use it from runtime.
*/
//@Target(AnnotationTarget.CLASS)
//@Retention(AnnotationRetention.SOURCE)
annotation class ExportTypeInfo(val name: String)
/**
* Suppresses the given compilation warnings in the annotated element.
* @property names names of the compiler diagnostics to suppress.
+4 -4
View File
@@ -1,6 +1,6 @@
package kotlin.io
@kotlin.SymbolName("Kotlin_io_Console_print")
@SymbolName("Kotlin_io_Console_print")
external public fun print(message: String)
/* TODO: use something like that.
@@ -39,7 +39,7 @@ public fun print(message: Boolean) {
print(message.toString())
}
@kotlin.SymbolName("Kotlin_io_Console_println")
@SymbolName("Kotlin_io_Console_println")
external public fun println(message: String)
// TODO: enable, once override by name is implemented.
@@ -79,8 +79,8 @@ public fun<T> println(message: T) {
print(message.toString())
} */
@kotlin.SymbolName("Kotlin_io_Console_println0")
@SymbolName("Kotlin_io_Console_println0")
external public fun println()
@kotlin.SymbolName("Kotlin_io_Console_readLine")
@SymbolName("Kotlin_io_Console_readLine")
external public fun readLine(): String