[K/N] Move CAdapter* to a separate package similar to objcexport
This commit is contained in:
committed by
Space Team
parent
573811a199
commit
f467afa94b
+1
@@ -12,6 +12,7 @@ import llvm.*
|
||||
import org.jetbrains.kotlin.backend.common.phaser.ActionState
|
||||
import org.jetbrains.kotlin.backend.common.phaser.BeforeOrAfter
|
||||
import org.jetbrains.kotlin.backend.common.serialization.KlibIrVersion
|
||||
import org.jetbrains.kotlin.backend.konan.cexport.produceCAdapterBitcode
|
||||
import org.jetbrains.kotlin.backend.konan.llvm.*
|
||||
import org.jetbrains.kotlin.backend.konan.llvm.objc.patchObjCRuntimeModule
|
||||
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
|
||||
|
||||
+1
@@ -9,6 +9,7 @@ import llvm.LLVMTypeRef
|
||||
import org.jetbrains.kotlin.backend.common.DefaultDelegateFactory
|
||||
import org.jetbrains.kotlin.backend.common.DefaultMapping
|
||||
import org.jetbrains.kotlin.backend.common.LoggingContext
|
||||
import org.jetbrains.kotlin.backend.konan.cexport.CAdapterGenerator
|
||||
import org.jetbrains.kotlin.backend.konan.descriptors.BridgeDirections
|
||||
import org.jetbrains.kotlin.backend.konan.descriptors.ClassLayoutBuilder
|
||||
import org.jetbrains.kotlin.backend.konan.descriptors.GlobalHierarchyAnalysisResult
|
||||
|
||||
+41
@@ -161,3 +161,44 @@ private fun MemberScope.getContributedClass(name: String): ClassDescriptor =
|
||||
|
||||
private fun MemberScope.getContributedFunctions(name: String) =
|
||||
this.getContributedFunctions(Name.identifier(name), NoLookupLocation.FROM_BUILTINS)
|
||||
|
||||
internal val cKeywords = setOf(
|
||||
// Actual C keywords.
|
||||
"auto", "break", "case",
|
||||
"char", "const", "continue",
|
||||
"default", "do", "double",
|
||||
"else", "enum", "extern",
|
||||
"float", "for", "goto",
|
||||
"if", "int", "long",
|
||||
"register", "return",
|
||||
"short", "signed", "sizeof", "static", "struct", "switch",
|
||||
"typedef", "union", "unsigned",
|
||||
"void", "volatile", "while",
|
||||
// C99-specific.
|
||||
"_Bool", "_Complex", "_Imaginary", "inline", "restrict",
|
||||
// C11-specific.
|
||||
"_Alignas", "_Alignof", "_Atomic", "_Generic", "_Noreturn", "_Static_assert", "_Thread_local",
|
||||
// Not exactly keywords, but reserved or standard-defined.
|
||||
"and", "not", "or", "xor",
|
||||
"bool", "complex", "imaginary",
|
||||
|
||||
// C++ keywords not listed above.
|
||||
"alignas", "alignof", "and_eq", "asm",
|
||||
"bitand", "bitor", "bool",
|
||||
"catch", "char16_t", "char32_t", "class", "compl", "constexpr", "const_cast",
|
||||
"decltype", "delete", "dynamic_cast",
|
||||
"explicit", "export",
|
||||
"false", "friend",
|
||||
"inline",
|
||||
"mutable",
|
||||
"namespace", "new", "noexcept", "not_eq", "nullptr",
|
||||
"operator", "or_eq",
|
||||
"private", "protected", "public",
|
||||
"reinterpret_cast",
|
||||
"static_assert",
|
||||
"template", "this", "thread_local", "throw", "true", "try", "typeid", "typename",
|
||||
"using",
|
||||
"virtual",
|
||||
"wchar_t",
|
||||
"xor_eq"
|
||||
)
|
||||
|
||||
+1
@@ -11,6 +11,7 @@ import org.jetbrains.kotlin.backend.common.checkDeclarationParents
|
||||
import org.jetbrains.kotlin.backend.common.phaser.*
|
||||
import org.jetbrains.kotlin.backend.common.serialization.CompatibilityMode
|
||||
import org.jetbrains.kotlin.backend.common.serialization.metadata.KlibMetadataMonolithicSerializer
|
||||
import org.jetbrains.kotlin.backend.konan.cexport.CAdapterGenerator
|
||||
import org.jetbrains.kotlin.backend.konan.descriptors.isFromInteropLibrary
|
||||
import org.jetbrains.kotlin.backend.konan.driver.phases.PsiToIrInput
|
||||
import org.jetbrains.kotlin.backend.konan.llvm.*
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.backend.konan
|
||||
package org.jetbrains.kotlin.backend.konan.cexport
|
||||
|
||||
import org.jetbrains.kotlin.konan.exec.*
|
||||
import org.jetbrains.kotlin.konan.target.*
|
||||
+8
-50
@@ -1,16 +1,16 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.backend.konan
|
||||
package org.jetbrains.kotlin.backend.konan.cexport
|
||||
|
||||
import kotlinx.cinterop.cValuesOf
|
||||
import java.io.PrintWriter
|
||||
import llvm.*
|
||||
import org.jetbrains.kotlin.backend.common.descriptors.allParameters
|
||||
import org.jetbrains.kotlin.backend.common.pop
|
||||
import org.jetbrains.kotlin.backend.common.push
|
||||
import org.jetbrains.kotlin.backend.konan.*
|
||||
import org.jetbrains.kotlin.backend.konan.llvm.*
|
||||
import org.jetbrains.kotlin.backend.konan.lower.getObjectClassInstanceFunction
|
||||
import org.jetbrains.kotlin.builtins.UnsignedType
|
||||
@@ -23,16 +23,15 @@ import org.jetbrains.kotlin.ir.util.SymbolTable
|
||||
import org.jetbrains.kotlin.ir.util.isOverridable
|
||||
import org.jetbrains.kotlin.ir.util.referenceFunction
|
||||
import org.jetbrains.kotlin.konan.target.*
|
||||
import org.jetbrains.kotlin.name.isChildOf
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.annotations.*
|
||||
import org.jetbrains.kotlin.name.isChildOf
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.annotations.*
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.*
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.typeUtil.isNothing
|
||||
import org.jetbrains.kotlin.types.typeUtil.isUnit
|
||||
import org.jetbrains.kotlin.types.typeUtil.makeNullable
|
||||
import org.jetbrains.kotlin.types.typeUtil.*
|
||||
import java.io.PrintWriter
|
||||
|
||||
private enum class ScopeKind {
|
||||
TOP,
|
||||
@@ -74,47 +73,6 @@ private val KotlinType.createNullableNameForPredefinedType
|
||||
private val KotlinType.createGetNonNullValueOfPredefinedType
|
||||
get() = "getNonNullValueOf${this.shortNameForPredefinedType}"
|
||||
|
||||
internal val cKeywords = setOf(
|
||||
// Actual C keywords.
|
||||
"auto", "break", "case",
|
||||
"char", "const", "continue",
|
||||
"default", "do", "double",
|
||||
"else", "enum", "extern",
|
||||
"float", "for", "goto",
|
||||
"if", "int", "long",
|
||||
"register", "return",
|
||||
"short", "signed", "sizeof", "static", "struct", "switch",
|
||||
"typedef", "union", "unsigned",
|
||||
"void", "volatile", "while",
|
||||
// C99-specific.
|
||||
"_Bool", "_Complex", "_Imaginary", "inline", "restrict",
|
||||
// C11-specific.
|
||||
"_Alignas", "_Alignof", "_Atomic", "_Generic", "_Noreturn", "_Static_assert", "_Thread_local",
|
||||
// Not exactly keywords, but reserved or standard-defined.
|
||||
"and", "not", "or", "xor",
|
||||
"bool", "complex", "imaginary",
|
||||
|
||||
// C++ keywords not listed above.
|
||||
"alignas", "alignof", "and_eq", "asm",
|
||||
"bitand", "bitor", "bool",
|
||||
"catch", "char16_t", "char32_t", "class", "compl", "constexpr", "const_cast",
|
||||
"decltype", "delete", "dynamic_cast",
|
||||
"explicit", "export",
|
||||
"false", "friend",
|
||||
"inline",
|
||||
"mutable",
|
||||
"namespace", "new", "noexcept", "not_eq", "nullptr",
|
||||
"operator", "or_eq",
|
||||
"private", "protected", "public",
|
||||
"reinterpret_cast",
|
||||
"static_assert",
|
||||
"template", "this", "thread_local", "throw", "true", "try", "typeid", "typename",
|
||||
"using",
|
||||
"virtual",
|
||||
"wchar_t",
|
||||
"xor_eq"
|
||||
)
|
||||
|
||||
private fun isExportedFunction(descriptor: FunctionDescriptor): Boolean {
|
||||
if (!descriptor.isEffectivelyPublicApi || !descriptor.kind.isReal || descriptor.isExpect)
|
||||
return false
|
||||
Reference in New Issue
Block a user