[KT-39120] Add "-fmodules" argument support to Cinterop

Merge-request: KT-MR-6921
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
This commit is contained in:
Vladimir Sukharev
2022-11-30 08:46:40 +00:00
committed by Space Team
parent 10fc86ef92
commit b883dc5434
173 changed files with 2707 additions and 214 deletions
@@ -151,7 +151,7 @@ public open class NativeIndexImpl(val library: NativeLibrary, val verbose: Boole
override lateinit var includedHeaders: List<HeaderId> override lateinit var includedHeaders: List<HeaderId>
private fun log(message: String) { internal fun log(message: String) {
if (verbose) { if (verbose) {
println(message) println(message)
} }
@@ -1187,67 +1187,85 @@ fun buildNativeIndexImpl(index: NativeIndexImpl): IndexerResult {
} }
private fun indexDeclarations(nativeIndex: NativeIndexImpl): CompilationWithPCH { private fun indexDeclarations(nativeIndex: NativeIndexImpl): CompilationWithPCH {
withIndex { index -> // Below, declarations from PCH should be excluded to restrict `visitChildren` to visit local declarations only
withIndex(excludeDeclarationsFromPCH = true) { index ->
val errors = mutableListOf<Diagnostic>()
val translationUnit = nativeIndex.library.copyWithArgsForPCH().parse( val translationUnit = nativeIndex.library.copyWithArgsForPCH().parse(
index, index,
options = CXTranslationUnit_DetailedPreprocessingRecord or CXTranslationUnit_ForSerialization options = CXTranslationUnit_DetailedPreprocessingRecord or CXTranslationUnit_ForSerialization,
diagnosticHandler = { if (it.isError()) errors.add(it) }
) )
try { try {
if (errors.isNotEmpty()) {
error(errors.take(10).joinToString("\n") { it.format })
}
translationUnit.ensureNoCompileErrors() translationUnit.ensureNoCompileErrors()
val compilation = nativeIndex.library.withPrecompiledHeader(translationUnit) val compilation = nativeIndex.library.withPrecompiledHeader(translationUnit)
val headers = getFilteredHeaders(nativeIndex, index, translationUnit) UnitsHolder(index).use { unitsHolder ->
val (headers, ownTranslationUnits) = getHeadersAndUnits(nativeIndex.library, index, translationUnit, unitsHolder)
val ownHeaders = headers.ownHeaders
val headersCanonicalPaths = ownHeaders.map { it?.canonicalPath }.toSet()
nativeIndex.includedHeaders = headers.map { val unitsToProcess = (ownTranslationUnits + setOf(translationUnit)).toList()
nativeIndex.getHeaderId(it)
}
indexTranslationUnit(index, translationUnit, 0, object : Indexer { nativeIndex.includedHeaders = ownHeaders.map {
override fun indexDeclaration(info: CXIdxDeclInfo) { nativeIndex.getHeaderId(it)
val file = memScoped {
val fileVar = alloc<CXFileVar>()
clang_indexLoc_getFileLocation(info.loc.readValue(), null, fileVar.ptr, null, null, null)
fileVar.value
}
if (file in headers) {
nativeIndex.indexDeclaration(info)
}
} }
})
if (nativeIndex.library.language == Language.CPP) { unitsToProcess.forEach {
visitChildren(clang_getTranslationUnitCursor(translationUnit)) { cursor, _ -> indexTranslationUnit(index, it, 0, object : Indexer {
if (getContainingFile(cursor) in headers) { override fun indexDeclaration(info: CXIdxDeclInfo) {
nativeIndex.indexCxxDeclaration(cursor) val file = memScoped {
} val fileVar = alloc<CXFileVar>()
CXChildVisitResult.CXChildVisit_Continue clang_indexLoc_getFileLocation(info.loc.readValue(), null, fileVar.ptr, null, null, null)
} fileVar.value
} }
visitChildren(clang_getTranslationUnitCursor(translationUnit)) { cursor, _ -> if (file?.canonicalPath in headersCanonicalPaths) {
val file = getContainingFile(cursor) nativeIndex.indexDeclaration(info)
if (file in headers && nativeIndex.library.includesDeclaration(cursor)) { }
when (cursor.kind) { }
CXCursorKind.CXCursor_ObjCInterfaceDecl -> nativeIndex.indexObjCClass(cursor) })
CXCursorKind.CXCursor_ObjCProtocolDecl -> nativeIndex.indexObjCProtocol(cursor) }
CXCursorKind.CXCursor_ObjCCategoryDecl -> {
// This fixes https://youtrack.jetbrains.com/issue/KT-49455, which effectively seems to be a bug in libclang: if (nativeIndex.library.language == Language.CPP) {
// the libclang indexer doesn't properly index categories with unitsToProcess.forEach {
// `__attribute__((external_source_symbol(language="Swift",...)))`. visitChildren(clang_getTranslationUnitCursor(it)) { cursor, _ ->
// As a workaround, additionally enumerate all the categories explicitly. if (getContainingFile(cursor) in ownHeaders) {
nativeIndex.indexObjCCategory(cursor) nativeIndex.indexCxxDeclaration(cursor)
}
CXChildVisitResult.CXChildVisit_Continue
} }
else -> {}
} }
} }
CXChildVisitResult.CXChildVisit_Continue
unitsToProcess.forEach {
visitChildren(clang_getTranslationUnitCursor(it)) { cursor, _ ->
val file = getContainingFile(cursor)
if (file in ownHeaders && nativeIndex.library.includesDeclaration(cursor)) {
when (cursor.kind) {
CXCursorKind.CXCursor_ObjCInterfaceDecl -> nativeIndex.indexObjCClass(cursor)
CXCursorKind.CXCursor_ObjCProtocolDecl -> nativeIndex.indexObjCProtocol(cursor)
CXCursorKind.CXCursor_ObjCCategoryDecl -> {
// This fixes https://youtrack.jetbrains.com/issue/KT-49455, which effectively seems to be a bug in libclang:
// the libclang indexer doesn't properly index categories with
// `__attribute__((external_source_symbol(language="Swift",...)))`.
// As a workaround, additionally enumerate all the categories explicitly.
nativeIndex.indexObjCCategory(cursor)
}
else -> {}
}
}
CXChildVisitResult.CXChildVisit_Continue
}
}
findMacros(nativeIndex, compilation, unitsToProcess, ownHeaders)
return compilation
} }
findMacros(nativeIndex, compilation, translationUnit, headers)
return compilation
} finally { } finally {
clang_disposeTranslationUnit(translationUnit) clang_disposeTranslationUnit(translationUnit)
} }
@@ -20,16 +20,18 @@ import clang.*
import kotlinx.cinterop.* import kotlinx.cinterop.*
import java.io.File import java.io.File
val predefinedMacros = setOf("__DATE__", "__TIME__", "__TIMESTAMP__", "__FILE__", "__FILE_NAME__", "__BASE_FILE__", "__LINE__")
/** /**
* Finds all "macro constants" and registers them as [NativeIndex.constants] in given index. * Finds all "macro constants" and registers them as [NativeIndex.constants] in given index.
*/ */
internal fun findMacros( internal fun findMacros(
nativeIndex: NativeIndexImpl, nativeIndex: NativeIndexImpl,
compilation: CompilationWithPCH, compilation: CompilationWithPCH,
translationUnit: CXTranslationUnit, translationUnits: List<CXTranslationUnit>,
headers: Set<CXFile?> headers: Set<CXFile?>
) { ) {
val names = collectMacroNames(nativeIndex, translationUnit, headers) val names = collectMacroNames(nativeIndex, translationUnits, headers)
// TODO: apply user-defined filters. // TODO: apply user-defined filters.
val macros = expandMacros(compilation, names, typeConverter = { nativeIndex.convertType(it) }) val macros = expandMacros(compilation, names, typeConverter = { nativeIndex.convertType(it) })
@@ -60,17 +62,10 @@ private fun expandMacros(
// or function-like construction (e.g. #define FOO throw()) but such a function is undeclared. // or function-like construction (e.g. #define FOO throw()) but such a function is undeclared.
compilerArgs += "-Werror=implicit-function-declaration" compilerArgs += "-Werror=implicit-function-declaration"
// Some predefined macros expand to contextual values that won't make sense to expose in Kotlin properties.
// We instead redefined them to string values of the macro name.
compilerArgs += "-Wno-builtin-macro-redefined"
val predefinedMacros = listOf("__DATE__", "__TIME__", "__TIMESTAMP__", "__FILE__", "__FILE_NAME__", "__BASE_FILE__", "__LINE__")
predefinedMacros.forEach {
compilerArgs += "-D${it}=\"${it}\""
}
// Ensure libclang reports all errors: // Ensure libclang reports all errors:
compilerArgs += "-ferror-limit=0" compilerArgs += "-ferror-limit=0"
val translationUnit = parseTranslationUnit(index, sourceFile, compilerArgs, options = 0) val translationUnit = parseTranslationUnit(index, sourceFile, compilerArgs, options = CXTranslationUnit_DetailedPreprocessingRecord)
try { try {
val nameToMacroDef = mutableMapOf<String, MacroDef>() val nameToMacroDef = mutableMapOf<String, MacroDef>()
val unprocessedMacros = names.toMutableList() val unprocessedMacros = names.toMutableList()
@@ -188,7 +183,7 @@ private fun reparseWithCodeSnippets(library: CompilationWithPCH,
codeSnippetLines.forEach { writer.appendLine(it) } codeSnippetLines.forEach { writer.appendLine(it) }
} }
} }
clang_reparseTranslationUnit(translationUnit, 0, null, 0) clang_reparseTranslationUnit(translationUnit, 0, null, CXTranslationUnit_DetailedPreprocessingRecord)
} }
/** /**
@@ -291,29 +286,30 @@ enum class VisitorState {
EXPECT_END, INVALID EXPECT_END, INVALID
} }
private fun collectMacroNames(nativeIndex: NativeIndexImpl, translationUnit: CXTranslationUnit, headers: Set<CXFile?>): List<String> { private fun collectMacroNames(nativeIndex: NativeIndexImpl, translationUnits: List<CXTranslationUnit>, headers: Set<CXFile?>): List<String> {
val result = mutableSetOf<String>() val result = mutableSetOf<String>()
visitChildren(translationUnit) { cursor, _ -> translationUnits.forEach {
val file = memScoped { visitChildren(it) { cursor, _ ->
val fileVar = alloc<CXFileVar>() val file = memScoped {
clang_getFileLocation(clang_getCursorLocation(cursor), fileVar.ptr, null, null, null) val fileVar = alloc<CXFileVar>()
fileVar.value clang_getFileLocation(clang_getCursorLocation(cursor), fileVar.ptr, null, null, null)
} fileVar.value
}
if (cursor.kind == CXCursorKind.CXCursor_MacroDefinition && if (cursor.kind == CXCursorKind.CXCursor_MacroDefinition &&
nativeIndex.library.includesDeclaration(cursor) && nativeIndex.library.includesDeclaration(cursor) &&
file != null && // Builtin macros mostly seem to be useless. file != null && // Builtin macros mostly seem to be useless.
file in headers && file in headers &&
canMacroBeConstant(cursor)) canMacroBeConstant(cursor)) {
{ val spelling = getCursorSpelling(cursor)
val spelling = getCursorSpelling(cursor) result.add(spelling)
result.add(spelling) }
CXChildVisitResult.CXChildVisit_Continue
} }
CXChildVisitResult.CXChildVisit_Continue
} }
return result.toList() return result.filterNot { predefinedMacros.contains(it) }.toList()
} }
private fun canMacroBeConstant(cursor: CValue<CXCursor>): Boolean { private fun canMacroBeConstant(cursor: CValue<CXCursor>): Boolean {
@@ -4,12 +4,12 @@ import clang.*
import kotlinx.cinterop.* import kotlinx.cinterop.*
import java.nio.file.Files import java.nio.file.Files
data class ModulesInfo(val topLevelHeaders: List<String>, val ownHeaders: Set<String>) data class ModulesInfo(val topLevelHeaders: List<String>, val ownHeaders: Set<String>, val modules: List<String>)
fun getModulesInfo(compilation: Compilation, modules: List<String>): ModulesInfo { fun getModulesInfo(compilation: Compilation, modules: List<String>): ModulesInfo {
if (modules.isEmpty()) return ModulesInfo(emptyList(), emptySet()) if (modules.isEmpty()) return ModulesInfo(emptyList(), emptySet(), emptyList())
withIndex { index -> withIndex(excludeDeclarationsFromPCH = false) { index ->
ModularCompilation(compilation).use { ModularCompilation(compilation).use {
val modulesASTFiles = getModulesASTFiles(index, it, modules) val modulesASTFiles = getModulesASTFiles(index, it, modules)
return buildModulesInfo(index, modules, modulesASTFiles) return buildModulesInfo(index, modules, modulesASTFiles)
@@ -30,7 +30,7 @@ private fun buildModulesInfo(index: CXIndex, modules: List<String>, modulesASTFi
} }
} }
return ModulesInfo(topLevelHeaders.toList(), ownHeaders) return ModulesInfo(topLevelHeaders.toList(), ownHeaders, modules)
} }
internal open class ModularCompilation(compilation: Compilation): Compilation by compilation, Disposable { internal open class ModularCompilation(compilation: Compilation): Compilation by compilation, Disposable {
@@ -48,7 +48,7 @@ sealed class NativeLibraryHeaderFilter {
val excludeDepdendentModules: Boolean val excludeDepdendentModules: Boolean
) : NativeLibraryHeaderFilter() ) : NativeLibraryHeaderFilter()
class Predefined(val headers: Set<String>) : NativeLibraryHeaderFilter() class Predefined(val headers: Set<String>, val modules: List<String>) : NativeLibraryHeaderFilter()
} }
interface Compilation { interface Compilation {
@@ -25,6 +25,7 @@ import java.nio.file.Path
import java.nio.file.Paths import java.nio.file.Paths
import java.security.DigestInputStream import java.security.DigestInputStream
import java.security.MessageDigest import java.security.MessageDigest
import java.util.*
import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.ConcurrentHashMap
val CValue<CXType>.kind: CXTypeKind get() = this.useContents { kind } val CValue<CXType>.kind: CXTypeKind get() = this.useContents { kind }
@@ -105,7 +106,7 @@ internal fun CValue<CXType>.getSize(): Long {
} }
internal inline fun <R> withIndex( internal inline fun <R> withIndex(
excludeDeclarationsFromPCH: Boolean = false, excludeDeclarationsFromPCH: Boolean, // disables visitChildren to visit declarations from imported translation units
displayDiagnostics: Boolean = false, displayDiagnostics: Boolean = false,
block: (index: CXIndex) -> R block: (index: CXIndex) -> R
): R { ): R {
@@ -404,8 +405,8 @@ data class CompilationImpl(
* *
* @return the library which includes the precompiled header instead of original ones. * @return the library which includes the precompiled header instead of original ones.
*/ */
fun Compilation.precompileHeaders(): CompilationWithPCH = withIndex { index -> fun Compilation.precompileHeaders(): CompilationWithPCH = withIndex(excludeDeclarationsFromPCH = false) { index ->
val options = CXTranslationUnit_ForSerialization val options = CXTranslationUnit_ForSerialization or CXTranslationUnit_DetailedPreprocessingRecord
val translationUnit = copyWithArgsForPCH().parse(index, options) val translationUnit = copyWithArgsForPCH().parse(index, options)
try { try {
translationUnit.ensureNoCompileErrors() translationUnit.ensureNoCompileErrors()
@@ -471,7 +472,7 @@ fun List<List<String>>.mapFragmentIsCompilable(originalLibrary: CompilationWithP
withIndex(excludeDeclarationsFromPCH = true) { index -> withIndex(excludeDeclarationsFromPCH = true) { index ->
val sourceFile = library.createTempSource() val sourceFile = library.createTempSource()
val translationUnit = parseTranslationUnit(index, sourceFile, library.compilerArgs, options = 0) val translationUnit = parseTranslationUnit(index, sourceFile, library.compilerArgs, options = CXTranslationUnit_DetailedPreprocessingRecord)
try { try {
translationUnit.ensureNoCompileErrors() translationUnit.ensureNoCompileErrors()
while (fragmentsToCheck.isNotEmpty()) { while (fragmentsToCheck.isNotEmpty()) {
@@ -486,7 +487,7 @@ fun List<List<String>>.mapFragmentIsCompilable(originalLibrary: CompilationWithP
} }
} }
clang_reparseTranslationUnit(translationUnit, 0, null, 0) clang_reparseTranslationUnit(translationUnit, 0, null, CXTranslationUnit_DetailedPreprocessingRecord)
val errorLineNumbers = translationUnit.getErrorLineNumbers().toSet() val errorLineNumbers = translationUnit.getErrorLineNumbers().toSet()
// Retain only those fragments that contain compilation error locations: // Retain only those fragments that contain compilation error locations:
@@ -653,19 +654,16 @@ internal fun getHeaderId(library: NativeLibrary, header: CXFile?): HeaderId {
return library.headerToIdMapper.getHeaderId(filePath) return library.headerToIdMapper.getHeaderId(filePath)
} }
internal fun getFilteredHeaders(
nativeIndex: NativeIndexImpl,
index: CXIndex,
translationUnit: CXTranslationUnit
): Set<CXFile?> = getHeaders(nativeIndex.library, index, translationUnit).ownHeaders
class NativeLibraryHeaders<Header>(val ownHeaders: Set<Header>, val importedHeaders: Set<Header>) class NativeLibraryHeaders<Header>(val ownHeaders: Set<Header>, val importedHeaders: Set<Header>)
data class NativeLibraryHeadersAndUnits(val headers: NativeLibraryHeaders<CXFile?>, val ownTranslationUnits: Set<CXTranslationUnit>)
internal fun getHeaders( internal fun getHeadersAndUnits(
library: NativeLibrary, library: NativeLibrary,
index: CXIndex, index: CXIndex,
translationUnit: CXTranslationUnit translationUnit: CXTranslationUnit,
): NativeLibraryHeaders<CXFile?> { unitsHolder: UnitsHolder
): NativeLibraryHeadersAndUnits {
val ownTranslationUnits = mutableSetOf<CXTranslationUnit>()
val ownHeaders = mutableSetOf<CXFile?>() val ownHeaders = mutableSetOf<CXFile?>()
val allHeaders = mutableSetOf<CXFile?>(null) val allHeaders = mutableSetOf<CXFile?>(null)
@@ -673,15 +671,31 @@ internal fun getHeaders(
when (filter) { when (filter) {
is NativeLibraryHeaderFilter.NameBased -> is NativeLibraryHeaderFilter.NameBased ->
filterHeadersByName(library, filter, index, translationUnit, ownHeaders, allHeaders) filterHeadersByName(library, filter, index, translationUnit, ownTranslationUnits, ownHeaders, allHeaders, unitsHolder)
is NativeLibraryHeaderFilter.Predefined -> is NativeLibraryHeaderFilter.Predefined ->
filterHeadersByPredefined(filter, index, translationUnit, ownHeaders, allHeaders) filterHeadersByPredefined(filter, index, translationUnit, ownTranslationUnits, ownHeaders, allHeaders, unitsHolder)
} }
ownHeaders.removeAll { library.headerExclusionPolicy.excludeAll(getHeaderId(library, it)) } ownHeaders.removeAll { library.headerExclusionPolicy.excludeAll(getHeaderId(library, it)) }
return NativeLibraryHeaders(ownHeaders, allHeaders - ownHeaders) return NativeLibraryHeadersAndUnits(NativeLibraryHeaders(ownHeaders, allHeaders - ownHeaders), ownTranslationUnits)
}
class UnitsHolder(val index: CXIndex) : Disposable {
private val unitByBinaryFile = mutableMapOf<String, CXTranslationUnit>()
internal fun load(info: CXIdxImportedASTFileInfo): CXTranslationUnit {
val canonicalPath: String = info.file!!.canonicalPath
return unitByBinaryFile.getOrPut(canonicalPath) {
clang_createTranslationUnit(index, canonicalPath)!!
}
}
override fun dispose() {
unitByBinaryFile.values.forEach { clang_disposeTranslationUnit(it) }
unitByBinaryFile.clear()
}
} }
private fun filterHeadersByName( private fun filterHeadersByName(
@@ -689,57 +703,78 @@ private fun filterHeadersByName(
filter: NativeLibraryHeaderFilter.NameBased, filter: NativeLibraryHeaderFilter.NameBased,
index: CXIndex, index: CXIndex,
translationUnit: CXTranslationUnit, translationUnit: CXTranslationUnit,
ownTranslationUnits: MutableSet<CXTranslationUnit>,
ownHeaders: MutableSet<CXFile?>, ownHeaders: MutableSet<CXFile?>,
allHeaders: MutableSet<CXFile?> allHeaders: MutableSet<CXFile?>,
unitsHolder: UnitsHolder
) { ) {
val topLevelFiles = mutableListOf<CXFile>() val topLevelFiles = mutableSetOf<CXFile>()
var mainFile: CXFile? = null var mainFile: CXFile? = null
val translationUnits = mutableListOf(translationUnit)
indexTranslationUnit(index, translationUnit, 0, object : Indexer { // The *name* of the header here is the path relative to the include path element., e.g. `curl/curl.h`.
val headerToName = mutableMapOf<CXFile, String>() val headerToName = mutableMapOf<String, String>()
// The *name* of the header here is the path relative to the include path element., e.g. `curl/curl.h`.
override fun enteredMainFile(file: CXFile) { var curUnitIndex = 0
mainFile = file while (curUnitIndex < translationUnits.size) {
allHeaders += file val curUnit = translationUnits[curUnitIndex++]
}
override fun ppIncludedFile(info: CXIdxIncludedFileInfo) { indexTranslationUnit(index, curUnit, 0, object : Indexer {
val includeLocation = clang_indexLoc_getCXSourceLocation(info.hashLoc.readValue()) override fun enteredMainFile(file: CXFile) {
val file = info.file!! mainFile = file
allHeaders += file
allHeaders += file
if (clang_Location_isFromMainFile(includeLocation) != 0) {
topLevelFiles.add(file)
} }
val name = info.filename!!.toKString() override fun ppIncludedFile(info: CXIdxIncludedFileInfo) {
val headerName = if (info.isAngled != 0) { val includeLocation = clang_indexLoc_getCXSourceLocation(info.hashLoc.readValue())
// If the header is included with `#include <$name>`, then `name` is probably val file = info.file!!
// the path relative to the include path element.
name
} else {
// If it is included with `#include "$name"`, then `name` can also be the path relative to the includer.
val includerFile = includeLocation.getContainingFile()!!
val includerName = headerToName[includerFile] ?: ""
val includerPath = includerFile.path
if (clang_getFile(translationUnit, Paths.get(includerPath).resolveSibling(name).toString()) == file) { allHeaders += file
// included file is accessible from the includer by `name` used as relative path, so
// `name` seems to be relative to the includer: if (clang_Location_isFromMainFile(includeLocation) != 0) {
Paths.get(includerName).resolveSibling(name).normalize().toString() topLevelFiles.add(file)
} else { }
val name = info.filename!!.toKString()
val headerName = if (info.isAngled != 0) {
// If the header is included with `#include <$name>`, then `name` is probably
// the path relative to the include path element.
name name
} else {
// If it is included with `#include "$name"`, then `name` can also be the path relative to the includer.
// Warning: containingFile is null when one module imports another via AST file
val includerFile = includeLocation.getContainingFile()!!
val includerName = headerToName[includerFile.canonicalPath] ?: ""
val includerPath = includerFile.path
val resolvedSibling = Paths.get(includerPath).resolveSibling(name).toString()
if (clang_getFile(curUnit, resolvedSibling) == file) {
// included file is accessible from the includer by `name` used as relative path, so
// `name` seems to be relative to the includer:
Paths.get(includerName).resolveSibling(name).normalize().toString()
} else {
name
}
}
headerToName[file.canonicalPath] = headerName
if (!filter.policy.excludeUnused(headerName)) {
ownHeaders.add(file)
ownTranslationUnits += curUnit
} }
} }
headerToName[file] = headerName override fun importedASTFile(info: CXIdxImportedASTFileInfo) {
if (!filter.policy.excludeUnused(headerName)) { unitsHolder.load(info).also { unit ->
ownHeaders.add(file) if (!translationUnits.contains(unit)) {
translationUnits.add(unit)
ownTranslationUnits += unit
}
}
} }
} })
}) }
if (filter.excludeDepdendentModules) { if (filter.excludeDepdendentModules) {
ModulesMap(compilation, translationUnit).use { modulesMap -> ModulesMap(compilation, translationUnit).use { modulesMap ->
@@ -765,35 +800,70 @@ private fun filterHeadersByPredefined(
filter: NativeLibraryHeaderFilter.Predefined, filter: NativeLibraryHeaderFilter.Predefined,
index: CXIndex, index: CXIndex,
translationUnit: CXTranslationUnit, translationUnit: CXTranslationUnit,
ownTranslationUnits: MutableSet<CXTranslationUnit>,
ownHeaders: MutableSet<CXFile?>, ownHeaders: MutableSet<CXFile?>,
allHeaders: MutableSet<CXFile?> allHeaders: MutableSet<CXFile?>,
unitsHolder: UnitsHolder
) { ) {
val translationUnits = mutableListOf(translationUnit)
// Note: suboptimal but simple. // Note: suboptimal but simple.
indexTranslationUnit(index, translationUnit, 0, object : Indexer { var curUnitIndex = 0
override fun enteredMainFile(file: CXFile) { while (curUnitIndex < translationUnits.size) {
ownHeaders += file indexTranslationUnit(index, translationUnits[curUnitIndex++], 0, object : Indexer {
allHeaders += file override fun enteredMainFile(file: CXFile) {
}
override fun ppIncludedFile(info: CXIdxIncludedFileInfo) {
val file = info.file
allHeaders += file
if (file?.canonicalPath in filter.headers) {
ownHeaders += file ownHeaders += file
allHeaders += file
} }
}
}) override fun ppIncludedFile(info: CXIdxIncludedFileInfo) {
val file = info.file
allHeaders += file
if (file?.canonicalPath in filter.headers) {
ownHeaders += file
}
}
override fun importedASTFile(info: CXIdxImportedASTFileInfo) {
unitsHolder.load(info).also { unit ->
if (!translationUnits.contains(unit)) {
translationUnits.add(unit)
// `info.module` might point to a submodule having name of a child header, not an actual name of a framework.
// Actual module name could be found at top of the parent chain
val topParentModuleName = getTopParentModule(info)?.name
if (filter.modules.contains(topParentModuleName)) {
ownTranslationUnits += unit
}
}
}
}
/**
* Follows parent links and returns name of the topmost parent module.
*/
private fun getTopParentModule(info: CXIdxImportedASTFileInfo): CXModule? {
var parent = info.module
var module: CXModule?
do {
module = parent
parent = clang_Module_getParent(module)
} while (parent != null)
return module
}
})
}
} }
fun NativeLibrary.getHeaderPaths(): NativeLibraryHeaders<String> { fun NativeLibrary.getHeaderPaths(): NativeLibraryHeaders<String> {
withIndex { index -> withIndex(excludeDeclarationsFromPCH = false) { index ->
val translationUnit = val translationUnit =
this.parse(index, options = CXTranslationUnit_DetailedPreprocessingRecord).ensureNoCompileErrors() this.parse(index, options = CXTranslationUnit_DetailedPreprocessingRecord).ensureNoCompileErrors()
try { try {
val (headers, _) = UnitsHolder(index).use { unitsHolder ->
getHeadersAndUnits(this, index, translationUnit, unitsHolder)
}
fun getPath(file: CXFile?) = if (file == null) "<builtins>" else file.canonicalPath fun getPath(file: CXFile?) = if (file == null) "<builtins>" else file.canonicalPath
val headers = getHeaders(this, index, translationUnit)
return NativeLibraryHeaders( return NativeLibraryHeaders(
headers.ownHeaders.map(::getPath).toSet(), headers.ownHeaders.map(::getPath).toSet(),
headers.importedHeaders.map(::getPath).toSet() headers.importedHeaders.map(::getPath).toSet()
@@ -837,6 +907,7 @@ internal fun getContainingFile(cursor: CValue<CXCursor>): CXFile? {
} }
internal val CXFile.path: String get() = clang_getFileName(this).convertAndDispose() internal val CXFile.path: String get() = clang_getFileName(this).convertAndDispose()
internal val CXModule.name: String get() = clang_Module_getName(this).convertAndDispose()
// TODO: this map doesn't get cleaned up but adds quite significant performance improvement. // TODO: this map doesn't get cleaned up but adds quite significant performance improvement.
private val canonicalPaths = ConcurrentHashMap<String, String>() private val canonicalPaths = ConcurrentHashMap<String, String>()
@@ -906,11 +977,11 @@ fun Type.canonicalIsPointerToChar(): Boolean {
return unwrappedType is PointerType && unwrappedType.pointeeType.unwrapTypedefs() == CharType return unwrappedType is PointerType && unwrappedType.pointeeType.unwrapTypedefs() == CharType
} }
internal interface Disposable { interface Disposable {
fun dispose() fun dispose()
} }
internal inline fun <T : Disposable, R> T.use(block: (T) -> R): R = try { inline fun <T : Disposable, R> T.use(block: (T) -> R): R = try {
block(this) block(this)
} finally { } finally {
this.dispose() this.dispose()
@@ -33,7 +33,7 @@ class WorkaroundTests : IndexerTests() {
compilerArgs = defaultCompilerArgs(language), compilerArgs = defaultCompilerArgs(language),
language = language language = language
) )
withIndex { index -> withIndex(excludeDeclarationsFromPCH = false) { index ->
val translationUnit = compilation.parse( val translationUnit = compilation.parse(
index, index,
options = CXTranslationUnit_DetailedPreprocessingRecord, options = CXTranslationUnit_DetailedPreprocessingRecord,
@@ -335,7 +335,8 @@ class StubIrBuilder(private val context: StubIrContext) {
nativeIndex.enums.forEach { generateStubsForEnum(it) } nativeIndex.enums.forEach { generateStubsForEnum(it) }
nativeIndex.functions.filter { it.name !in excludedFunctions }.forEach { generateStubsForFunction(it) } nativeIndex.functions.filter { it.name !in excludedFunctions }.forEach { generateStubsForFunction(it) }
nativeIndex.typedefs.forEach { generateStubsForTypedef(it) } nativeIndex.typedefs.forEach { generateStubsForTypedef(it) }
nativeIndex.globals.filter { it.name !in excludedFunctions }.forEach { generateStubsForGlobal(it) } // globals are sorted, so its numbering is stable and thus testable with golden data
nativeIndex.globals.filter { it.name !in excludedFunctions }.sortedBy { it.name }.forEach { generateStubsForGlobal(it) }
nativeIndex.macroConstants.filter { it.name !in excludedMacros }.forEach { generateStubsForMacroConstant(it) } nativeIndex.macroConstants.filter { it.name !in excludedMacros }.forEach { generateStubsForMacroConstant(it) }
nativeIndex.wrappedMacros.filter { it.name !in excludedMacros }.forEach { generateStubsForWrappedMacro(it) } nativeIndex.wrappedMacros.filter { it.name !in excludedMacros }.forEach { generateStubsForWrappedMacro(it) }
@@ -68,21 +68,36 @@ fun main(args: Array<String>) {
processCLibSafe(flavorName, arguments, InternalInteropOptions(arguments.generated, arguments.natives), runFromDaemon = false) processCLibSafe(flavorName, arguments, InternalInteropOptions(arguments.generated, arguments.natives), runFromDaemon = false)
} }
fun interop( class Interop {
flavor: String, args: Array<String>, /**
additionalArgs: InternalInteropOptions, * invoked via reflection from new test system: CompilationToolCallKt.invokeCInterop(),
runFromDaemon: Boolean * `interop()` has issues to be invoked directly due to NoSuchMethodError, caused by presence of InternalInteropOptions argtype:
): Array<String>? = when (flavor) { * java.lang.IllegalArgumentException: argument type mismatch
"jvm", "native" -> { */
val cinteropArguments = CInteropArguments() fun interopViaReflection(
cinteropArguments.argParser.parse(args) flavor: String, args: Array<String>,
val platform = KotlinPlatform.values().single { it.name.equals(flavor, ignoreCase = true) } runFromDaemon: Boolean,
processCLibSafe(platform, cinteropArguments, additionalArgs, runFromDaemon) generated: String, natives: String, manifest: String? = null, cstubsName: String? = null
): Array<String>? {
val internalInteropOptions = InternalInteropOptions(generated, natives, manifest, cstubsName)
return interop(flavor, args, internalInteropOptions, runFromDaemon)
} }
"wasm" -> processIdlLib(args, additionalArgs)
else -> error("Unexpected flavor")
}
fun interop(
flavor: String, args: Array<String>,
additionalArgs: InternalInteropOptions,
runFromDaemon: Boolean
): Array<String>? = when (flavor) {
"jvm", "native" -> {
val cinteropArguments = CInteropArguments()
cinteropArguments.argParser.parse(args)
val platform = KotlinPlatform.values().single { it.name.equals(flavor, ignoreCase = true) }
processCLibSafe(platform, cinteropArguments, additionalArgs, runFromDaemon)
}
"wasm" -> processIdlLib(args, additionalArgs)
else -> error("Unexpected flavor")
}
}
// Options, whose values are space-separated and can be escaped. // Options, whose values are space-separated and can be escaped.
val escapedOptions = setOf("-compilerOpts", "-linkerOpts", "-compiler-options", "-linker-options") val escapedOptions = setOf("-compilerOpts", "-linkerOpts", "-compiler-options", "-linker-options")
@@ -390,7 +405,7 @@ private fun processCLib(flavor: KotlinPlatform, cinteropArguments: CInteropArgum
// Note that the output bitcode contains the source file path, which can lead to non-deterministc builds (see KT-54284). // Note that the output bitcode contains the source file path, which can lead to non-deterministc builds (see KT-54284).
// The source file is passed in via stdin to ensure the output library is deterministic. // The source file is passed in via stdin to ensure the output library is deterministic.
val compilerCmd = arrayOf(compiler, *compilerArgs, val compilerCmd = arrayOf(compiler, *compilerArgs,
"-emit-llvm", "-x", library.language.clangLanguageName, "-c", "-", "-o", outLib.absolutePath) "-emit-llvm", "-x", library.language.clangLanguageName, "-c", "-", "-o", outLib.absolutePath, "-Xclang", "-detailed-preprocessing-record")
runCmd(compilerCmd, verbose, redirectInputFile = File(outCFile.absolutePath)) runCmd(compilerCmd, verbose, redirectInputFile = File(outCFile.absolutePath))
outLib.absolutePath outLib.absolutePath
} }
@@ -496,11 +511,19 @@ internal fun buildNativeLibrary(
addAll(tool.getDefaultCompilerOptsForLanguage(language)) addAll(tool.getDefaultCompilerOptsForLanguage(language))
addAll(additionalCompilerOpts) addAll(additionalCompilerOpts)
addAll(getCompilerFlagsForVfsOverlay(arguments.headerFilterPrefix.toTypedArray(), def)) addAll(getCompilerFlagsForVfsOverlay(arguments.headerFilterPrefix.toTypedArray(), def))
add("-Wno-builtin-macro-redefined") // to suppress warning from predefinedMacrosRedefinitions(see below)
}
// Expanding macros such as __FILE__ or __TIME__ exposes arbitrary generated filenames and timestamps from the compiler pipeline
// which are not useful for interop though makes the klib generation non-deterministic. See KT-54284
// This macro redefinition just maps to their name in the properties available from Kotlin.
val predefinedMacrosRedefinitions = predefinedMacros.map {
"#define $it \"$it\""
} }
val compilation = CompilationImpl( val compilation = CompilationImpl(
includes = headerFiles, includes = headerFiles,
additionalPreambleLines = def.defHeaderLines, additionalPreambleLines = def.defHeaderLines + predefinedMacrosRedefinitions,
compilerArgs = defaultCompilerArgs(language) + compilerOpts + tool.platformCompilerOpts, compilerArgs = defaultCompilerArgs(language) + compilerOpts + tool.platformCompilerOpts,
language = language language = language
) )
@@ -511,6 +534,7 @@ internal fun buildNativeLibrary(
val modules = def.config.modules val modules = def.config.modules
if (modules.isEmpty()) { if (modules.isEmpty()) {
require(headerFiles.isEmpty() || !compilation.compilerArgs.contains("-fmodules")) { "cinterop doesn't support having headers in -fmodules mode" }
val excludeDependentModules = def.config.excludeDependentModules val excludeDependentModules = def.config.excludeDependentModules
val headerFilterGlobs = def.config.headerFilter val headerFilterGlobs = def.config.headerFilter
@@ -526,7 +550,7 @@ internal fun buildNativeLibrary(
val modulesInfo = getModulesInfo(compilation, modules) val modulesInfo = getModulesInfo(compilation, modules)
headerFilter = NativeLibraryHeaderFilter.Predefined(modulesInfo.ownHeaders) headerFilter = NativeLibraryHeaderFilter.Predefined(modulesInfo.ownHeaders, modulesInfo.modules)
includes = modulesInfo.topLevelHeaders includes = modulesInfo.topLevelHeaders
} }
@@ -13,7 +13,6 @@ import org.jetbrains.kotlin.native.interop.gen.jvm.KotlinPlatform
import org.jetbrains.kotlin.native.interop.gen.jvm.buildNativeLibrary import org.jetbrains.kotlin.native.interop.gen.jvm.buildNativeLibrary
import org.jetbrains.kotlin.native.interop.gen.jvm.prepareTool import org.jetbrains.kotlin.native.interop.gen.jvm.prepareTool
import org.jetbrains.kotlin.native.interop.indexer.NativeLibrary import org.jetbrains.kotlin.native.interop.indexer.NativeLibrary
import org.jetbrains.kotlin.native.interop.indexer.getHeaderPaths
import org.jetbrains.kotlin.native.interop.tool.CInteropArguments import org.jetbrains.kotlin.native.interop.tool.CInteropArguments
import kotlin.test.* import kotlin.test.*
import java.io.File import java.io.File
@@ -4315,6 +4315,11 @@ createInterop("kt54284") {
it.defFile 'interop/kt54284/kt54284.def' it.defFile 'interop/kt54284/kt54284.def'
} }
createInterop("kt54284_fmodules") {
it.defFile 'interop/kt54284/kt54284.def'
it.extraOpts '-compiler-option', '-fmodules'
}
createInterop("kt43502") { createInterop("kt43502") {
it.defFile 'interop/kt43502/kt43502.def' it.defFile 'interop/kt43502/kt43502.def'
it.headers "$projectDir/interop/kt43502/kt43502.h" it.headers "$projectDir/interop/kt43502/kt43502.h"
@@ -4795,6 +4800,12 @@ interopTest("interop_kt54284") {
source = "interop/kt54284/main.kt" source = "interop/kt54284/main.kt"
} }
interopTest("interop_kt54284_fmodules") {
disabled = (project.testTarget == 'wasm32') // No interop for wasm yet.
interop = 'kt54284_fmodules'
source = "interop/kt54284/main.kt"
}
// TODO: This test should be run with caches on. // TODO: This test should be run with caches on.
interopTest("interop_kt51925") { interopTest("interop_kt51925") {
disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. disabled = (project.testTarget == 'wasm32') // No interop for wasm yet.
@@ -3,10 +3,10 @@ import kt54284.*
import kotlin.test.* import kotlin.test.*
fun main() { fun main() {
assertEquals(KFILE, "FILE:__FILE__") assertEquals("FILE:__FILE__", KFILE)
assertEquals(KLINE, "LINE:__LINE__") assertEquals("LINE:__LINE__", KLINE)
assertEquals(KTIME, "TIME:__TIME__") assertEquals("TIME:__TIME__", KTIME)
assertEquals(KDATE, "DATE:__DATE__") assertEquals("DATE:__DATE__", KDATE)
assertEquals(KFILENAME, "NAME:__FILE_NAME__") assertEquals("NAME:__FILE_NAME__", KFILENAME)
assertEquals(KBASEFILE, "BASE:__BASE_FILE__") assertEquals("BASE:__BASE_FILE__", KBASEFILE)
} }
@@ -9,7 +9,7 @@ import org.jetbrains.kotlin.konan.file.File
import org.jetbrains.kotlin.konan.target.PlatformManager import org.jetbrains.kotlin.konan.target.PlatformManager
import org.jetbrains.kotlin.konan.util.KonanHomeProvider import org.jetbrains.kotlin.konan.util.KonanHomeProvider
import org.jetbrains.kotlin.native.interop.gen.jvm.InternalInteropOptions import org.jetbrains.kotlin.native.interop.gen.jvm.InternalInteropOptions
import org.jetbrains.kotlin.native.interop.gen.jvm.interop import org.jetbrains.kotlin.native.interop.gen.jvm.Interop
import org.jetbrains.kotlin.native.interop.tool.* import org.jetbrains.kotlin.native.interop.tool.*
// TODO: this function should eventually be eliminated from 'utilities'. // TODO: this function should eventually be eliminated from 'utilities'.
@@ -42,7 +42,7 @@ fun invokeInterop(flavor: String, args: Array<String>, runFromDaemon: Boolean):
else (arguments as JSInteropArguments).target.toString() else (arguments as JSInteropArguments).target.toString()
val target = PlatformManager(KonanHomeProvider.determineKonanHome()).targetManager(targetRequest).target val target = PlatformManager(KonanHomeProvider.determineKonanHome()).targetManager(targetRequest).target
val cinteropArgsToCompiler = interop(flavor, args, val cinteropArgsToCompiler = Interop().interop(flavor, args,
InternalInteropOptions(generatedDir.absolutePath, InternalInteropOptions(generatedDir.absolutePath,
nativesDir.absolutePath,manifest.path, nativesDir.absolutePath,manifest.path,
cstubsName.takeIf { flavor == "native" } cstubsName.takeIf { flavor == "native" }
+18 -1
View File
@@ -1,5 +1,22 @@
## Running tests ## Running tests
For tests, use `./gradlew :native:native.tests:codegenBoxTest` and `./gradlew :kotlin-native:backend.native:tests:run`. * To run all tests, use `./gradlew :native:native.tests:test`. Please note, this Gradle task is available only in development environment and it not available at CI server.
* To execute certain tests only, use the appropriate Gradle tasks. Example: `./gradlew :native:native.tests:codegenBoxTest`
* To execute InteropIndexer tests for all targets, use:
```bash
for TARGET in android_x64 android_x86 android_arm32 android_arm64 \
ios_arm32 ios_arm64 ios_x64 ios_simulator_arm64 \
linux_x64 linux_arm64 linux_arm32_hfp linux_mips32 linux_mipsel32 \
macos_x64 macos_arm64 \
mingw_x86 mingw_x64 \
tvos_arm64 tvos_x64 tvos_simulator_arm64 \
wasm32 \
watchos_arm32 watchos_arm64 watchos_x86 watchos_x64 watchos_simulator_arm64 watchos_device_arm64
do
echo $TARGET
./gradlew :native:native.tests:interopIndexerTest -Pkotlin.internal.native.test.target=$TARGET
done
```
* To re-generate tests, use `./gradlew :native:native.tests:generateTests`
For more details see [Testing](../../kotlin-native/HACKING.md#Testing). For more details see [Testing](../../kotlin-native/HACKING.md#Testing).
+1
View File
@@ -48,6 +48,7 @@ val stdlibTest = nativeTest("stdlibTest", "stdlib")
val kotlinTestLibraryTest = nativeTest("kotlinTestLibraryTest", "kotlin-test") val kotlinTestLibraryTest = nativeTest("kotlinTestLibraryTest", "kotlin-test")
val klibAbiTest = nativeTest("klibAbiTest", "klib-abi") val klibAbiTest = nativeTest("klibAbiTest", "klib-abi")
val klibBinaryCompatibilityTest = nativeTest("klibBinaryCompatibilityTest", "klib-binary-compatibility") val klibBinaryCompatibilityTest = nativeTest("klibBinaryCompatibilityTest", "klib-binary-compatibility")
val cinteropTest = nativeTest("cinteropTest", "cinterop")
// "test" task is created by convention. We can't just remove it. Let's enable it in developer's environment, so it can be used // "test" task is created by convention. We can't just remove it. Let's enable it in developer's environment, so it can be used
// to run any test from IDE or from console, but disable it at TeamCity where it is not supposed to be ever used. // to run any test from IDE or from console, but disable it at TeamCity where it is not supposed to be ever used.
@@ -0,0 +1,4 @@
@ExternalObjCClass open class Pod1 : NSObject {
@ExternalObjCClass open class Pod1Meta : NSObjectMeta {
var pod1VersionNumber: Double
val pod1VersionString: CArrayPointer<UByteVar /* = UByteVarOf<UByte> */> /* = CPointer<UByteVar /* = UByteVarOf<UByte> */> */
@@ -0,0 +1,2 @@
language = Objective-C
modules = pod1
@@ -0,0 +1,4 @@
@ExternalObjCClass(binaryName = "_TtC4pod24Pod2") open class Pod2 : Pod1 {
@ExternalObjCClass(binaryName = "_TtC4pod24Pod2") open class Pod2Meta : Pod1Meta {
var pod2VersionNumber: Double
val pod2VersionString: CArrayPointer<UByteVar /* = UByteVarOf<UByte> */> /* = CPointer<UByteVar /* = UByteVarOf<UByte> */> */
@@ -0,0 +1,2 @@
language = Objective-C
modules = pod2
@@ -0,0 +1,4 @@
const val POD1MACRO: Int = 42
var intPOD1: Int
@CCall(id = "knifunptr_pod10_intPOD1_getter") get
@CCall(id = "knifunptr_pod11_intPOD1_setter") set
@@ -0,0 +1,2 @@
language = Objective-C
modules = interpod1
@@ -0,0 +1,4 @@
const val POD2POD1MACRO: Int = 42
var pointerIntPOD1: CPointer<IntVar /* = IntVarOf<Int> */>?
@CCall(id = "knifunptr_pod20_pointerIntPOD1_getter") get
@CCall(id = "knifunptr_pod21_pointerIntPOD1_setter") set
@@ -0,0 +1,2 @@
language = Objective-C
modules = interpod2
@@ -0,0 +1,3 @@
int intPOD1;
#define POD1MACRO 42
@@ -0,0 +1,6 @@
framework module interpod1 {
umbrella header "interpod1.h"
export *
module * { export * }
}
@@ -0,0 +1,4 @@
#include "interpod1/interpod1.h"
int* pointerIntPOD1 = &intPOD1;
#define POD2POD1MACRO POD1MACRO
@@ -0,0 +1,6 @@
framework module interpod2 {
umbrella header "interpod2.h"
export *
module * { export * }
}
@@ -0,0 +1,16 @@
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#else
#ifndef FOUNDATION_EXPORT
#if defined(__cplusplus)
#define FOUNDATION_EXPORT extern "C"
#else
#define FOUNDATION_EXPORT extern
#endif
#endif
#endif
#import "pod1.h"
FOUNDATION_EXPORT double pod1VersionNumber;
FOUNDATION_EXPORT const unsigned char pod1VersionString[];
@@ -0,0 +1,3 @@
@interface Pod1 : NSObject
-(int)pod1;
@end
@@ -0,0 +1,6 @@
framework module pod1 {
umbrella header "pod1-umbrella.h"
export *
module * { export * }
}
@@ -0,0 +1,220 @@
#ifndef __POD2_SWIFT_H__
#define __POD2_SWIFT_H__
// Generated by Apple Swift version 5.2.2 (swiftlang-1103.0.32.6 clang-1103.0.32.51)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wgcc-compat"
#if !defined(__has_include)
# define __has_include(x) 0
#endif
#if !defined(__has_attribute)
# define __has_attribute(x) 0
#endif
#if !defined(__has_feature)
# define __has_feature(x) 0
#endif
#if !defined(__has_warning)
# define __has_warning(x) 0
#endif
#if __has_include(<swift/objc-prologue.h>)
# include <swift/objc-prologue.h>
#endif
#pragma clang diagnostic ignored "-Wauto-import"
#include <Foundation/Foundation.h>
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#if !defined(SWIFT_TYPEDEFS)
# define SWIFT_TYPEDEFS 1
# if __has_include(<uchar.h>)
# include <uchar.h>
# elif !defined(__cplusplus)
typedef uint_least16_t char16_t;
typedef uint_least32_t char32_t;
# endif
typedef float swift_float2 __attribute__((__ext_vector_type__(2)));
typedef float swift_float33 __attribute__((__ext_vector_type__(3)));
typedef float swift_float4 __attribute__((__ext_vector_type__(4)));
typedef double swift_double2 __attribute__((__ext_vector_type__(2)));
typedef double swift_double3 __attribute__((__ext_vector_type__(3)));
typedef double swift_double4 __attribute__((__ext_vector_type__(4)));
typedef int swift_int2 __attribute__((__ext_vector_type__(2)));
typedef int swift_int3 __attribute__((__ext_vector_type__(3)));
typedef int swift_int4 __attribute__((__ext_vector_type__(4)));
typedef unsigned int swift_uint2 __attribute__((__ext_vector_type__(2)));
typedef unsigned int swift_uint3 __attribute__((__ext_vector_type__(3)));
typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
#endif
#if !defined(SWIFT_PASTE)
# define SWIFT_PASTE_HELPER(x, y) x##y
# define SWIFT_PASTE(x, y) SWIFT_PASTE_HELPER(x, y)
#endif
#if !defined(SWIFT_METATYPE)
# define SWIFT_METATYPE(X) Class
#endif
#if !defined(SWIFT_CLASS_PROPERTY)
# if __has_feature(objc_class_property)
# define SWIFT_CLASS_PROPERTY(...) __VA_ARGS__
# else
# define SWIFT_CLASS_PROPERTY(...)
# endif
#endif
#if __has_attribute(objc_runtime_name)
# define SWIFT_RUNTIME_NAME(X) __attribute__((objc_runtime_name(X)))
#else
# define SWIFT_RUNTIME_NAME(X)
#endif
#if __has_attribute(swift_name)
# define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X)))
#else
# define SWIFT_COMPILE_NAME(X)
#endif
#if __has_attribute(objc_method_family)
# define SWIFT_METHOD_FAMILY(X) __attribute__((objc_method_family(X)))
#else
# define SWIFT_METHOD_FAMILY(X)
#endif
#if __has_attribute(noescape)
# define SWIFT_NOESCAPE __attribute__((noescape))
#else
# define SWIFT_NOESCAPE
#endif
#if __has_attribute(ns_consumed)
# define SWIFT_RELEASES_ARGUMENT __attribute__((ns_consumed))
#else
# define SWIFT_RELEASES_ARGUMENT
#endif
#if __has_attribute(warn_unused_result)
# define SWIFT_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
#else
# define SWIFT_WARN_UNUSED_RESULT
#endif
#if __has_attribute(noreturn)
# define SWIFT_NORETURN __attribute__((noreturn))
#else
# define SWIFT_NORETURN
#endif
#if !defined(SWIFT_CLASS_EXTRA)
# define SWIFT_CLASS_EXTRA
#endif
#if !defined(SWIFT_PROTOCOL_EXTRA)
# define SWIFT_PROTOCOL_EXTRA
#endif
#if !defined(SWIFT_ENUM_EXTRA)
# define SWIFT_ENUM_EXTRA
#endif
#if !defined(SWIFT_CLASS)
# if __has_attribute(objc_subclassing_restricted)
# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA
# define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
# else
# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
# define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
# endif
#endif
#if !defined(SWIFT_RESILIENT_CLASS)
# if __has_attribute(objc_class_stub)
# define SWIFT_RESILIENT_CLASS(SWIFT_NAME) SWIFT_CLASS(SWIFT_NAME) __attribute__((objc_class_stub))
# define SWIFT_RESILIENT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_class_stub)) SWIFT_CLASS_NAMED(SWIFT_NAME)
# else
# define SWIFT_RESILIENT_CLASS(SWIFT_NAME) SWIFT_CLASS(SWIFT_NAME)
# define SWIFT_RESILIENT_CLASS_NAMED(SWIFT_NAME) SWIFT_CLASS_NAMED(SWIFT_NAME)
# endif
#endif
#if !defined(SWIFT_PROTOCOL)
# define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
# define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
#endif
#if !defined(SWIFT_EXTENSION)
# define SWIFT_EXTENSION(M) SWIFT_PASTE(M##_Swift_, __LINE__)
#endif
#if !defined(OBJC_DESIGNATED_INITIALIZER)
# if __has_attribute(objc_designated_initializer)
# define OBJC_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer))
# else
# define OBJC_DESIGNATED_INITIALIZER
# endif
#endif
#if !defined(SWIFT_ENUM_ATTR)
# if defined(__has_attribute) && __has_attribute(enum_extensibility)
# define SWIFT_ENUM_ATTR(_extensibility) __attribute__((enum_extensibility(_extensibility)))
# else
# define SWIFT_ENUM_ATTR(_extensibility)
# endif
#endif
#if !defined(SWIFT_ENUM)
# define SWIFT_ENUM(_type, _name, _extensibility) enum _name : _type _name; enum SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
# if __has_feature(generalized_swift_name)
# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) enum _name : _type _name SWIFT_COMPILE_NAME(SWIFT_NAME); enum SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
# else
# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) SWIFT_ENUM(_type, _name, _extensibility)
# endif
#endif
#if !defined(SWIFT_UNAVAILABLE)
# define SWIFT_UNAVAILABLE __attribute__((unavailable))
#endif
#if !defined(SWIFT_UNAVAILABLE_MSG)
# define SWIFT_UNAVAILABLE_MSG(msg) __attribute__((unavailable(msg)))
#endif
#if !defined(SWIFT_AVAILABILITY)
# define SWIFT_AVAILABILITY(plat, ...) __attribute__((availability(plat, __VA_ARGS__)))
#endif
#if !defined(SWIFT_WEAK_IMPORT)
# define SWIFT_WEAK_IMPORT __attribute__((weak_import))
#endif
#if !defined(SWIFT_DEPRECATED)
# define SWIFT_DEPRECATED __attribute__((deprecated))
#endif
#if !defined(SWIFT_DEPRECATED_MSG)
# define SWIFT_DEPRECATED_MSG(...) __attribute__((deprecated(__VA_ARGS__)))
#endif
#if __has_feature(attribute_diagnose_if_objc)
# define SWIFT_DEPRECATED_OBJC(Msg) __attribute__((diagnose_if(1, Msg, "warning")))
#else
# define SWIFT_DEPRECATED_OBJC(Msg) SWIFT_DEPRECATED_MSG(Msg)
#endif
#if !defined(IBSegueAction)
# define IBSegueAction
#endif
#if __has_feature(modules)
#if __has_warning("-Watimport-in-framework-header")
#pragma clang diagnostic ignored "-Watimport-in-framework-header"
#endif
@import pod1;
#endif
#pragma clang diagnostic ignored "-Wproperty-attribute-mismatch"
#pragma clang diagnostic ignored "-Wduplicate-method-arg"
#if __has_warning("-Wpragma-clang-attribute")
# pragma clang diagnostic ignored "-Wpragma-clang-attribute"
#endif
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma clang diagnostic ignored "-Wnullability"
#if __has_attribute(external_source_symbol)
# pragma push_macro("any")
# undef any
# pragma clang attribute push(__attribute__((external_source_symbol(language="Swift", defined_in="pod2",generated_declaration))), apply_to=any(function,enum,objc_interface,objc_category,objc_protocol))
# pragma pop_macro("any")
#endif
SWIFT_CLASS("_TtC4pod24Pod2")
@interface Pod2 : Pod1
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
@end
#if __has_attribute(external_source_symbol)
# pragma clang attribute pop
#endif
#pragma clang diagnostic pop
#endif
@@ -0,0 +1,16 @@
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#else
#ifndef FOUNDATION_EXPORT
#if defined(__cplusplus)
#define FOUNDATION_EXPORT extern "C"
#else
#define FOUNDATION_EXPORT extern
#endif
#endif
#endif
FOUNDATION_EXPORT double pod2VersionNumber;
FOUNDATION_EXPORT const unsigned char pod2VersionString[];
@@ -0,0 +1,11 @@
framework module pod2 {
umbrella header "pod2-umbrella.h"
export *
module * { export * }
}
module pod2.Swift {
header "pod2-Swift.h"
requires objc
}
@@ -0,0 +1,21 @@
package pod1 {
@CStruct(spelling = "struct { void* __ap; }") class __va_list constructor(rawPtr: NativePtr /* = NativePtr */) : CStructVar {
var __ap: COpaquePointer? /* = CPointer<out CPointed>? */
@CStruct.MemberAt(offset = 0.toLong()) get
@CStruct.MemberAt(offset = 0.toLong()) set
@CStruct.VarType(align = 4, size = 4.toLong()) @Deprecated(level = DeprecationLevel.WARNING, message = "Use sizeOf<T>() or alignOf<T>() instead.", replaceWith = ReplaceWith(imports = {})) companion object : CStructVar.Type
}
}
package pod1 {
var A: Int
@CCall(id = "knifunptr_pod10_A_getter") get
@CCall(id = "knifunptr_pod11_A_setter") set
val A_va_list: __builtin_va_list /* = __va_list */
@CCall(id = "knifunptr_pod12_A_va_list_getter") get
typealias __builtin_va_list = __va_list
}
@@ -0,0 +1,33 @@
package pod1 {
@CStruct(spelling = "struct { void* __stack; void* __gr_top; void* __vr_top; int __gr_offs; int __vr_offs; }") class __va_list constructor(rawPtr: NativePtr /* = NativePtr */) : CStructVar {
var __gr_offs: Int
@CStruct.MemberAt(offset = 24.toLong()) get
@CStruct.MemberAt(offset = 24.toLong()) set
var __gr_top: COpaquePointer? /* = CPointer<out CPointed>? */
@CStruct.MemberAt(offset = 8.toLong()) get
@CStruct.MemberAt(offset = 8.toLong()) set
var __stack: COpaquePointer? /* = CPointer<out CPointed>? */
@CStruct.MemberAt(offset = 0.toLong()) get
@CStruct.MemberAt(offset = 0.toLong()) set
var __vr_offs: Int
@CStruct.MemberAt(offset = 28.toLong()) get
@CStruct.MemberAt(offset = 28.toLong()) set
var __vr_top: COpaquePointer? /* = CPointer<out CPointed>? */
@CStruct.MemberAt(offset = 16.toLong()) get
@CStruct.MemberAt(offset = 16.toLong()) set
@CStruct.VarType(align = 8, size = 32.toLong()) @Deprecated(level = DeprecationLevel.WARNING, message = "Use sizeOf<T>() or alignOf<T>() instead.", replaceWith = ReplaceWith(imports = {})) companion object : CStructVar.Type
}
}
package pod1 {
var A: Int
@CCall(id = "knifunptr_pod10_A_getter") get
@CCall(id = "knifunptr_pod11_A_setter") set
val A_va_list: __builtin_va_list /* = __va_list */
@CCall(id = "knifunptr_pod12_A_va_list_getter") get
typealias __builtin_va_list = __va_list
}
@@ -0,0 +1,12 @@
package pod1 {
var A: Int
@CCall(id = "knifunptr_pod10_A_getter") get
@CCall(id = "knifunptr_pod11_A_setter") set
var A_va_list: __builtin_va_list? /* = CPointer<out CPointed>? */
@CCall(id = "knifunptr_pod12_A_va_list_getter") get
@CCall(id = "knifunptr_pod13_A_va_list_setter") set
typealias __builtin_va_list = COpaquePointer
typealias __builtin_va_listVar = CPointerVarOf<__builtin_va_list /* = CPointer<out CPointed> */>
}
@@ -0,0 +1,12 @@
package pod1 {
var A: Int
@CCall(id = "knifunptr_pod10_A_getter") get
@CCall(id = "knifunptr_pod11_A_setter") set
var A_va_list: __builtin_va_list? /* = CPointer<ByteVar /* = ByteVarOf<Byte> */>? */
@CCall(id = "knifunptr_pod12_A_va_list_getter") get
@CCall(id = "knifunptr_pod13_A_va_list_setter") set
typealias __builtin_va_list = CPointer<ByteVar /* = ByteVarOf<Byte> */>
typealias __builtin_va_listVar = CPointerVarOf<__builtin_va_list /* = CPointer<ByteVar /* = ByteVarOf<Byte> */> */>
}
@@ -0,0 +1,31 @@
package pod1 {
@CStruct(spelling = "struct { unsigned int gp_offset; unsigned int fp_offset; void* overflow_arg_area; void* reg_save_area; }") class __va_list_tag constructor(rawPtr: NativePtr /* = NativePtr */) : CStructVar {
var fp_offset: UInt
@CStruct.MemberAt(offset = 4.toLong()) get
@CStruct.MemberAt(offset = 4.toLong()) set
var gp_offset: UInt
@CStruct.MemberAt(offset = 0.toLong()) get
@CStruct.MemberAt(offset = 0.toLong()) set
var overflow_arg_area: COpaquePointer? /* = CPointer<out CPointed>? */
@CStruct.MemberAt(offset = 8.toLong()) get
@CStruct.MemberAt(offset = 8.toLong()) set
var reg_save_area: COpaquePointer? /* = CPointer<out CPointed>? */
@CStruct.MemberAt(offset = 16.toLong()) get
@CStruct.MemberAt(offset = 16.toLong()) set
@CStruct.VarType(align = 8, size = 24.toLong()) @Deprecated(level = DeprecationLevel.WARNING, message = "Use sizeOf<T>() or alignOf<T>() instead.", replaceWith = ReplaceWith(imports = {})) companion object : CStructVar.Type
}
}
package pod1 {
var A: Int
@CCall(id = "knifunptr_pod10_A_getter") get
@CCall(id = "knifunptr_pod11_A_setter") set
val A_va_list: __builtin_va_list /* = CPointer<__va_list_tag> */
@CCall(id = "knifunptr_pod12_A_va_list_getter") get
typealias __builtin_va_list = CArrayPointer<__va_list_tag>
typealias __builtin_va_listVar = CPointerVarOf<__builtin_va_list /* = CPointer<__va_list_tag> */>
}
@@ -0,0 +1,3 @@
language = C
headers = A.h
headerFilter = A.h
@@ -0,0 +1,19 @@
package pod1 {
@CStruct(spelling = "struct { void* __ap; }") class __va_list constructor(rawPtr: NativePtr /* = NativePtr */) : CStructVar {
var __ap: COpaquePointer? /* = CPointer<out CPointed>? */
@CStruct.MemberAt(offset = 0.toLong()) get
@CStruct.MemberAt(offset = 0.toLong()) set
@CStruct.VarType(align = 4, size = 4.toLong()) @Deprecated(level = DeprecationLevel.WARNING, message = "Use sizeOf<T>() or alignOf<T>() instead.", replaceWith = ReplaceWith(imports = {})) companion object : CStructVar.Type
}
}
package pod1 {
const val __GNUC_VA_LIST: Int = 1
typealias __builtin_va_list = __va_list
typealias __gnuc_va_list = __builtin_va_list
typealias va_list = __builtin_va_list
}
@@ -0,0 +1,31 @@
package pod1 {
@CStruct(spelling = "struct { void* __stack; void* __gr_top; void* __vr_top; int __gr_offs; int __vr_offs; }") class __va_list constructor(rawPtr: NativePtr /* = NativePtr */) : CStructVar {
var __gr_offs: Int
@CStruct.MemberAt(offset = 24.toLong()) get
@CStruct.MemberAt(offset = 24.toLong()) set
var __gr_top: COpaquePointer? /* = CPointer<out CPointed>? */
@CStruct.MemberAt(offset = 8.toLong()) get
@CStruct.MemberAt(offset = 8.toLong()) set
var __stack: COpaquePointer? /* = CPointer<out CPointed>? */
@CStruct.MemberAt(offset = 0.toLong()) get
@CStruct.MemberAt(offset = 0.toLong()) set
var __vr_offs: Int
@CStruct.MemberAt(offset = 28.toLong()) get
@CStruct.MemberAt(offset = 28.toLong()) set
var __vr_top: COpaquePointer? /* = CPointer<out CPointed>? */
@CStruct.MemberAt(offset = 16.toLong()) get
@CStruct.MemberAt(offset = 16.toLong()) set
@CStruct.VarType(align = 8, size = 32.toLong()) @Deprecated(level = DeprecationLevel.WARNING, message = "Use sizeOf<T>() or alignOf<T>() instead.", replaceWith = ReplaceWith(imports = {})) companion object : CStructVar.Type
}
}
package pod1 {
const val __GNUC_VA_LIST: Int = 1
typealias __builtin_va_list = __va_list
typealias __gnuc_va_list = __builtin_va_list
typealias va_list = __builtin_va_list
}
@@ -0,0 +1,11 @@
package pod1 {
const val __GNUC_VA_LIST: Int = 1
typealias __builtin_va_list = COpaquePointer
typealias __builtin_va_listVar = CPointerVarOf<__builtin_va_list /* = CPointer<out CPointed> */>
typealias __gnuc_va_list = __builtin_va_list
typealias __gnuc_va_listVar = CPointerVarOf<__gnuc_va_list /* = CPointer<out CPointed> */>
typealias va_list = __builtin_va_list
typealias va_listVar = CPointerVarOf<va_list /* = CPointer<out CPointed> */>
}
@@ -0,0 +1,11 @@
package pod1 {
const val __GNUC_VA_LIST: Int = 1
typealias __builtin_va_list = CPointer<ByteVar /* = ByteVarOf<Byte> */>
typealias __builtin_va_listVar = CPointerVarOf<__builtin_va_list /* = CPointer<ByteVar /* = ByteVarOf<Byte> */> */>
typealias __gnuc_va_list = __builtin_va_list
typealias __gnuc_va_listVar = CPointerVarOf<__gnuc_va_list /* = CPointer<ByteVar /* = ByteVarOf<Byte> */> */>
typealias va_list = __builtin_va_list
typealias va_listVar = CPointerVarOf<va_list /* = CPointer<ByteVar /* = ByteVarOf<Byte> */> */>
}
@@ -0,0 +1,31 @@
package pod1 {
@CStruct(spelling = "struct { unsigned int gp_offset; unsigned int fp_offset; void* overflow_arg_area; void* reg_save_area; }") class __va_list_tag constructor(rawPtr: NativePtr /* = NativePtr */) : CStructVar {
var fp_offset: UInt
@CStruct.MemberAt(offset = 4.toLong()) get
@CStruct.MemberAt(offset = 4.toLong()) set
var gp_offset: UInt
@CStruct.MemberAt(offset = 0.toLong()) get
@CStruct.MemberAt(offset = 0.toLong()) set
var overflow_arg_area: COpaquePointer? /* = CPointer<out CPointed>? */
@CStruct.MemberAt(offset = 8.toLong()) get
@CStruct.MemberAt(offset = 8.toLong()) set
var reg_save_area: COpaquePointer? /* = CPointer<out CPointed>? */
@CStruct.MemberAt(offset = 16.toLong()) get
@CStruct.MemberAt(offset = 16.toLong()) set
@CStruct.VarType(align = 8, size = 24.toLong()) @Deprecated(level = DeprecationLevel.WARNING, message = "Use sizeOf<T>() or alignOf<T>() instead.", replaceWith = ReplaceWith(imports = {})) companion object : CStructVar.Type
}
}
package pod1 {
const val __GNUC_VA_LIST: Int = 1
typealias __builtin_va_list = CArrayPointer<__va_list_tag>
typealias __builtin_va_listVar = CPointerVarOf<__builtin_va_list /* = CPointer<__va_list_tag> */>
typealias __gnuc_va_list = __builtin_va_list
typealias __gnuc_va_listVar = CPointerVarOf<__gnuc_va_list /* = CPointer<__va_list_tag> */>
typealias va_list = __builtin_va_list
typealias va_listVar = CPointerVarOf<va_list /* = CPointer<__va_list_tag> */>
}
@@ -0,0 +1,3 @@
language = C
headers = stdarg.h
headerFilter = stdarg.h
@@ -0,0 +1,24 @@
package pod1 {
@CStruct(spelling = "struct { void* __ap; }") class __va_list constructor(rawPtr: NativePtr /* = NativePtr */) : CStructVar {
var __ap: COpaquePointer? /* = CPointer<out CPointed>? */
@CStruct.MemberAt(offset = 0.toLong()) get
@CStruct.MemberAt(offset = 0.toLong()) set
@CStruct.VarType(align = 4, size = 4.toLong()) @Deprecated(level = DeprecationLevel.WARNING, message = "Use sizeOf<T>() or alignOf<T>() instead.", replaceWith = ReplaceWith(imports = {})) companion object : CStructVar.Type
}
}
package pod1 {
var A: Int
@CCall(id = "knifunptr_pod10_A_getter") get
@CCall(id = "knifunptr_pod11_A_setter") set
val A_va_list: __builtin_va_list /* = __va_list */
@CCall(id = "knifunptr_pod12_A_va_list_getter") get
const val __GNUC_VA_LIST: Int = 1
typealias __builtin_va_list = __va_list
typealias __gnuc_va_list = __builtin_va_list
typealias va_list = __builtin_va_list
}
@@ -0,0 +1,36 @@
package pod1 {
@CStruct(spelling = "struct { void* __stack; void* __gr_top; void* __vr_top; int __gr_offs; int __vr_offs; }") class __va_list constructor(rawPtr: NativePtr /* = NativePtr */) : CStructVar {
var __gr_offs: Int
@CStruct.MemberAt(offset = 24.toLong()) get
@CStruct.MemberAt(offset = 24.toLong()) set
var __gr_top: COpaquePointer? /* = CPointer<out CPointed>? */
@CStruct.MemberAt(offset = 8.toLong()) get
@CStruct.MemberAt(offset = 8.toLong()) set
var __stack: COpaquePointer? /* = CPointer<out CPointed>? */
@CStruct.MemberAt(offset = 0.toLong()) get
@CStruct.MemberAt(offset = 0.toLong()) set
var __vr_offs: Int
@CStruct.MemberAt(offset = 28.toLong()) get
@CStruct.MemberAt(offset = 28.toLong()) set
var __vr_top: COpaquePointer? /* = CPointer<out CPointed>? */
@CStruct.MemberAt(offset = 16.toLong()) get
@CStruct.MemberAt(offset = 16.toLong()) set
@CStruct.VarType(align = 8, size = 32.toLong()) @Deprecated(level = DeprecationLevel.WARNING, message = "Use sizeOf<T>() or alignOf<T>() instead.", replaceWith = ReplaceWith(imports = {})) companion object : CStructVar.Type
}
}
package pod1 {
var A: Int
@CCall(id = "knifunptr_pod10_A_getter") get
@CCall(id = "knifunptr_pod11_A_setter") set
val A_va_list: __builtin_va_list /* = __va_list */
@CCall(id = "knifunptr_pod12_A_va_list_getter") get
const val __GNUC_VA_LIST: Int = 1
typealias __builtin_va_list = __va_list
typealias __gnuc_va_list = __builtin_va_list
typealias va_list = __builtin_va_list
}
@@ -0,0 +1,17 @@
package pod1 {
var A: Int
@CCall(id = "knifunptr_pod10_A_getter") get
@CCall(id = "knifunptr_pod11_A_setter") set
var A_va_list: __builtin_va_list? /* = CPointer<out CPointed>? */
@CCall(id = "knifunptr_pod12_A_va_list_getter") get
@CCall(id = "knifunptr_pod13_A_va_list_setter") set
const val __GNUC_VA_LIST: Int = 1
typealias __builtin_va_list = COpaquePointer
typealias __builtin_va_listVar = CPointerVarOf<__builtin_va_list /* = CPointer<out CPointed> */>
typealias __gnuc_va_list = __builtin_va_list
typealias __gnuc_va_listVar = CPointerVarOf<__gnuc_va_list /* = CPointer<out CPointed> */>
typealias va_list = __builtin_va_list
typealias va_listVar = CPointerVarOf<va_list /* = CPointer<out CPointed> */>
}
@@ -0,0 +1,17 @@
package pod1 {
var A: Int
@CCall(id = "knifunptr_pod10_A_getter") get
@CCall(id = "knifunptr_pod11_A_setter") set
var A_va_list: __builtin_va_list? /* = CPointer<ByteVar /* = ByteVarOf<Byte> */>? */
@CCall(id = "knifunptr_pod12_A_va_list_getter") get
@CCall(id = "knifunptr_pod13_A_va_list_setter") set
const val __GNUC_VA_LIST: Int = 1
typealias __builtin_va_list = CPointer<ByteVar /* = ByteVarOf<Byte> */>
typealias __builtin_va_listVar = CPointerVarOf<__builtin_va_list /* = CPointer<ByteVar /* = ByteVarOf<Byte> */> */>
typealias __gnuc_va_list = __builtin_va_list
typealias __gnuc_va_listVar = CPointerVarOf<__gnuc_va_list /* = CPointer<ByteVar /* = ByteVarOf<Byte> */> */>
typealias va_list = __builtin_va_list
typealias va_listVar = CPointerVarOf<va_list /* = CPointer<ByteVar /* = ByteVarOf<Byte> */> */>
}
@@ -0,0 +1,36 @@
package pod1 {
@CStruct(spelling = "struct { unsigned int gp_offset; unsigned int fp_offset; void* overflow_arg_area; void* reg_save_area; }") class __va_list_tag constructor(rawPtr: NativePtr /* = NativePtr */) : CStructVar {
var fp_offset: UInt
@CStruct.MemberAt(offset = 4.toLong()) get
@CStruct.MemberAt(offset = 4.toLong()) set
var gp_offset: UInt
@CStruct.MemberAt(offset = 0.toLong()) get
@CStruct.MemberAt(offset = 0.toLong()) set
var overflow_arg_area: COpaquePointer? /* = CPointer<out CPointed>? */
@CStruct.MemberAt(offset = 8.toLong()) get
@CStruct.MemberAt(offset = 8.toLong()) set
var reg_save_area: COpaquePointer? /* = CPointer<out CPointed>? */
@CStruct.MemberAt(offset = 16.toLong()) get
@CStruct.MemberAt(offset = 16.toLong()) set
@CStruct.VarType(align = 8, size = 24.toLong()) @Deprecated(level = DeprecationLevel.WARNING, message = "Use sizeOf<T>() or alignOf<T>() instead.", replaceWith = ReplaceWith(imports = {})) companion object : CStructVar.Type
}
}
package pod1 {
var A: Int
@CCall(id = "knifunptr_pod10_A_getter") get
@CCall(id = "knifunptr_pod11_A_setter") set
val A_va_list: __builtin_va_list /* = CPointer<__va_list_tag> */
@CCall(id = "knifunptr_pod12_A_va_list_getter") get
const val __GNUC_VA_LIST: Int = 1
typealias __builtin_va_list = CArrayPointer<__va_list_tag>
typealias __builtin_va_listVar = CPointerVarOf<__builtin_va_list /* = CPointer<__va_list_tag> */>
typealias __gnuc_va_list = __builtin_va_list
typealias __gnuc_va_listVar = CPointerVarOf<__gnuc_va_list /* = CPointer<__va_list_tag> */>
typealias va_list = __builtin_va_list
typealias va_listVar = CPointerVarOf<va_list /* = CPointer<__va_list_tag> */>
}
@@ -0,0 +1,2 @@
language = C
headers = A.h
@@ -0,0 +1,19 @@
package pod1 {
@CStruct(spelling = "struct { void* __ap; }") class __va_list constructor(rawPtr: NativePtr /* = NativePtr */) : CStructVar {
var __ap: COpaquePointer? /* = CPointer<out CPointed>? */
@CStruct.MemberAt(offset = 0.toLong()) get
@CStruct.MemberAt(offset = 0.toLong()) set
@CStruct.VarType(align = 4, size = 4.toLong()) @Deprecated(level = DeprecationLevel.WARNING, message = "Use sizeOf<T>() or alignOf<T>() instead.", replaceWith = ReplaceWith(imports = {})) companion object : CStructVar.Type
}
}
package pod1 {
const val __GNUC_VA_LIST: Int = 1
typealias __builtin_va_list = __va_list
typealias __gnuc_va_list = __builtin_va_list
typealias va_list = __builtin_va_list
}
@@ -0,0 +1,31 @@
package pod1 {
@CStruct(spelling = "struct { void* __stack; void* __gr_top; void* __vr_top; int __gr_offs; int __vr_offs; }") class __va_list constructor(rawPtr: NativePtr /* = NativePtr */) : CStructVar {
var __gr_offs: Int
@CStruct.MemberAt(offset = 24.toLong()) get
@CStruct.MemberAt(offset = 24.toLong()) set
var __gr_top: COpaquePointer? /* = CPointer<out CPointed>? */
@CStruct.MemberAt(offset = 8.toLong()) get
@CStruct.MemberAt(offset = 8.toLong()) set
var __stack: COpaquePointer? /* = CPointer<out CPointed>? */
@CStruct.MemberAt(offset = 0.toLong()) get
@CStruct.MemberAt(offset = 0.toLong()) set
var __vr_offs: Int
@CStruct.MemberAt(offset = 28.toLong()) get
@CStruct.MemberAt(offset = 28.toLong()) set
var __vr_top: COpaquePointer? /* = CPointer<out CPointed>? */
@CStruct.MemberAt(offset = 16.toLong()) get
@CStruct.MemberAt(offset = 16.toLong()) set
@CStruct.VarType(align = 8, size = 32.toLong()) @Deprecated(level = DeprecationLevel.WARNING, message = "Use sizeOf<T>() or alignOf<T>() instead.", replaceWith = ReplaceWith(imports = {})) companion object : CStructVar.Type
}
}
package pod1 {
const val __GNUC_VA_LIST: Int = 1
typealias __builtin_va_list = __va_list
typealias __gnuc_va_list = __builtin_va_list
typealias va_list = __builtin_va_list
}
@@ -0,0 +1,11 @@
package pod1 {
const val __GNUC_VA_LIST: Int = 1
typealias __builtin_va_list = COpaquePointer
typealias __builtin_va_listVar = CPointerVarOf<__builtin_va_list /* = CPointer<out CPointed> */>
typealias __gnuc_va_list = __builtin_va_list
typealias __gnuc_va_listVar = CPointerVarOf<__gnuc_va_list /* = CPointer<out CPointed> */>
typealias va_list = __builtin_va_list
typealias va_listVar = CPointerVarOf<va_list /* = CPointer<out CPointed> */>
}
@@ -0,0 +1,11 @@
package pod1 {
const val __GNUC_VA_LIST: Int = 1
typealias __builtin_va_list = CPointer<ByteVar /* = ByteVarOf<Byte> */>
typealias __builtin_va_listVar = CPointerVarOf<__builtin_va_list /* = CPointer<ByteVar /* = ByteVarOf<Byte> */> */>
typealias __gnuc_va_list = __builtin_va_list
typealias __gnuc_va_listVar = CPointerVarOf<__gnuc_va_list /* = CPointer<ByteVar /* = ByteVarOf<Byte> */> */>
typealias va_list = __builtin_va_list
typealias va_listVar = CPointerVarOf<va_list /* = CPointer<ByteVar /* = ByteVarOf<Byte> */> */>
}
@@ -0,0 +1,31 @@
package pod1 {
@CStruct(spelling = "struct { unsigned int gp_offset; unsigned int fp_offset; void* overflow_arg_area; void* reg_save_area; }") class __va_list_tag constructor(rawPtr: NativePtr /* = NativePtr */) : CStructVar {
var fp_offset: UInt
@CStruct.MemberAt(offset = 4.toLong()) get
@CStruct.MemberAt(offset = 4.toLong()) set
var gp_offset: UInt
@CStruct.MemberAt(offset = 0.toLong()) get
@CStruct.MemberAt(offset = 0.toLong()) set
var overflow_arg_area: COpaquePointer? /* = CPointer<out CPointed>? */
@CStruct.MemberAt(offset = 8.toLong()) get
@CStruct.MemberAt(offset = 8.toLong()) set
var reg_save_area: COpaquePointer? /* = CPointer<out CPointed>? */
@CStruct.MemberAt(offset = 16.toLong()) get
@CStruct.MemberAt(offset = 16.toLong()) set
@CStruct.VarType(align = 8, size = 24.toLong()) @Deprecated(level = DeprecationLevel.WARNING, message = "Use sizeOf<T>() or alignOf<T>() instead.", replaceWith = ReplaceWith(imports = {})) companion object : CStructVar.Type
}
}
package pod1 {
const val __GNUC_VA_LIST: Int = 1
typealias __builtin_va_list = CArrayPointer<__va_list_tag>
typealias __builtin_va_listVar = CPointerVarOf<__builtin_va_list /* = CPointer<__va_list_tag> */>
typealias __gnuc_va_list = __builtin_va_list
typealias __gnuc_va_listVar = CPointerVarOf<__gnuc_va_list /* = CPointer<__va_list_tag> */>
typealias va_list = __builtin_va_list
typealias va_listVar = CPointerVarOf<va_list /* = CPointer<__va_list_tag> */>
}
@@ -0,0 +1,2 @@
language = C
headers = stdarg.h
@@ -0,0 +1,21 @@
package pod1 {
@CStruct(spelling = "struct { void* __ap; }") class __va_list constructor(rawPtr: NativePtr /* = NativePtr */) : CStructVar {
var __ap: COpaquePointer? /* = CPointer<out CPointed>? */
@CStruct.MemberAt(offset = 0.toLong()) get
@CStruct.MemberAt(offset = 0.toLong()) set
@CStruct.VarType(align = 4, size = 4.toLong()) @Deprecated(level = DeprecationLevel.WARNING, message = "Use sizeOf<T>() or alignOf<T>() instead.", replaceWith = ReplaceWith(imports = {})) companion object : CStructVar.Type
}
}
package pod1 {
var A: Int
@CCall(id = "knifunptr_pod10_A_getter") get
@CCall(id = "knifunptr_pod11_A_setter") set
val A_va_list: __builtin_va_list /* = __va_list */
@CCall(id = "knifunptr_pod12_A_va_list_getter") get
typealias __builtin_va_list = __va_list
}
@@ -0,0 +1,33 @@
package pod1 {
@CStruct(spelling = "struct { void* __stack; void* __gr_top; void* __vr_top; int __gr_offs; int __vr_offs; }") class __va_list constructor(rawPtr: NativePtr /* = NativePtr */) : CStructVar {
var __gr_offs: Int
@CStruct.MemberAt(offset = 24.toLong()) get
@CStruct.MemberAt(offset = 24.toLong()) set
var __gr_top: COpaquePointer? /* = CPointer<out CPointed>? */
@CStruct.MemberAt(offset = 8.toLong()) get
@CStruct.MemberAt(offset = 8.toLong()) set
var __stack: COpaquePointer? /* = CPointer<out CPointed>? */
@CStruct.MemberAt(offset = 0.toLong()) get
@CStruct.MemberAt(offset = 0.toLong()) set
var __vr_offs: Int
@CStruct.MemberAt(offset = 28.toLong()) get
@CStruct.MemberAt(offset = 28.toLong()) set
var __vr_top: COpaquePointer? /* = CPointer<out CPointed>? */
@CStruct.MemberAt(offset = 16.toLong()) get
@CStruct.MemberAt(offset = 16.toLong()) set
@CStruct.VarType(align = 8, size = 32.toLong()) @Deprecated(level = DeprecationLevel.WARNING, message = "Use sizeOf<T>() or alignOf<T>() instead.", replaceWith = ReplaceWith(imports = {})) companion object : CStructVar.Type
}
}
package pod1 {
var A: Int
@CCall(id = "knifunptr_pod10_A_getter") get
@CCall(id = "knifunptr_pod11_A_setter") set
val A_va_list: __builtin_va_list /* = __va_list */
@CCall(id = "knifunptr_pod12_A_va_list_getter") get
typealias __builtin_va_list = __va_list
}
@@ -0,0 +1,12 @@
package pod1 {
var A: Int
@CCall(id = "knifunptr_pod10_A_getter") get
@CCall(id = "knifunptr_pod11_A_setter") set
var A_va_list: __builtin_va_list? /* = CPointer<out CPointed>? */
@CCall(id = "knifunptr_pod12_A_va_list_getter") get
@CCall(id = "knifunptr_pod13_A_va_list_setter") set
typealias __builtin_va_list = COpaquePointer
typealias __builtin_va_listVar = CPointerVarOf<__builtin_va_list /* = CPointer<out CPointed> */>
}
@@ -0,0 +1,12 @@
package pod1 {
var A: Int
@CCall(id = "knifunptr_pod10_A_getter") get
@CCall(id = "knifunptr_pod11_A_setter") set
var A_va_list: __builtin_va_list? /* = CPointer<ByteVar /* = ByteVarOf<Byte> */>? */
@CCall(id = "knifunptr_pod12_A_va_list_getter") get
@CCall(id = "knifunptr_pod13_A_va_list_setter") set
typealias __builtin_va_list = CPointer<ByteVar /* = ByteVarOf<Byte> */>
typealias __builtin_va_listVar = CPointerVarOf<__builtin_va_list /* = CPointer<ByteVar /* = ByteVarOf<Byte> */> */>
}
@@ -0,0 +1,31 @@
package pod1 {
@CStruct(spelling = "struct { unsigned int gp_offset; unsigned int fp_offset; void* overflow_arg_area; void* reg_save_area; }") class __va_list_tag constructor(rawPtr: NativePtr /* = NativePtr */) : CStructVar {
var fp_offset: UInt
@CStruct.MemberAt(offset = 4.toLong()) get
@CStruct.MemberAt(offset = 4.toLong()) set
var gp_offset: UInt
@CStruct.MemberAt(offset = 0.toLong()) get
@CStruct.MemberAt(offset = 0.toLong()) set
var overflow_arg_area: COpaquePointer? /* = CPointer<out CPointed>? */
@CStruct.MemberAt(offset = 8.toLong()) get
@CStruct.MemberAt(offset = 8.toLong()) set
var reg_save_area: COpaquePointer? /* = CPointer<out CPointed>? */
@CStruct.MemberAt(offset = 16.toLong()) get
@CStruct.MemberAt(offset = 16.toLong()) set
@CStruct.VarType(align = 8, size = 24.toLong()) @Deprecated(level = DeprecationLevel.WARNING, message = "Use sizeOf<T>() or alignOf<T>() instead.", replaceWith = ReplaceWith(imports = {})) companion object : CStructVar.Type
}
}
package pod1 {
var A: Int
@CCall(id = "knifunptr_pod10_A_getter") get
@CCall(id = "knifunptr_pod11_A_setter") set
val A_va_list: __builtin_va_list /* = CPointer<__va_list_tag> */
@CCall(id = "knifunptr_pod12_A_va_list_getter") get
typealias __builtin_va_list = CArrayPointer<__va_list_tag>
typealias __builtin_va_listVar = CPointerVarOf<__builtin_va_list /* = CPointer<__va_list_tag> */>
}
@@ -0,0 +1,2 @@
language = Objective-C
modules = A
@@ -0,0 +1,4 @@
#import <stdarg.h>
int A;
__builtin_va_list A_va_list;
@@ -0,0 +1,4 @@
module A {
header "A.h"
export *
}
@@ -0,0 +1,9 @@
package pod1 {
const val MY_MACRO_CONST_POD1: Int = 42
const val MY_MACRO_CONST_POD1A: Int = 153
var myVar: Double
@CCall(id = "knifunptr_pod10_myVar_getter") get
@CCall(id = "knifunptr_pod11_myVar_setter") set
}
@@ -0,0 +1,2 @@
language = Objective-C
modules = pod1
@@ -0,0 +1,9 @@
package pod1 {
const val MY_MACRO_CONST_POD1: Int = 42
const val MY_MACRO_CONST_POD1A: Int = 153
var myVar: Double
@CCall(id = "knifunptr_pod10_myVar_getter") get
@CCall(id = "knifunptr_pod11_myVar_setter") set
}
@@ -0,0 +1,2 @@
language = C
headers=pod1/pod1.h
@@ -0,0 +1,8 @@
#ifndef __POD1_H__
#define __POD1_H__
#import "pod1A.h"
MY_MACRO_TYPE myVar;
#define MY_MACRO_CONST_POD1 42
#endif
@@ -0,0 +1,7 @@
#ifndef __POD1A_H__
#define __POD1A_H__
#define MY_MACRO_TYPE double
#define MY_MACRO_CONST_POD1A 153
#endif
@@ -0,0 +1,6 @@
framework module pod1 {
umbrella header "pod1.h"
export *
module * { export * }
}
@@ -0,0 +1,2 @@
@import m1;
int child;
@@ -0,0 +1,2 @@
#import <childImport/child.h>
int umbrella;
@@ -0,0 +1,7 @@
framework module childImport {
umbrella header "umbrella.h"
export *
module * { export * }
}
@@ -0,0 +1,10 @@
package pod1 {
var child: Int
@CCall(id = "knifunptr_pod10_child_getter") get
@CCall(id = "knifunptr_pod11_child_setter") set
var umbrella: Int
@CCall(id = "knifunptr_pod12_umbrella_getter") get
@CCall(id = "knifunptr_pod13_umbrella_setter") set
}
@@ -0,0 +1,2 @@
language = Objective-C
modules = childImport
@@ -0,0 +1,10 @@
package pod1 {
var pod1A: Int
@CCall(id = "knifunptr_pod10_pod1A_getter") get
@CCall(id = "knifunptr_pod11_pod1A_setter") set
var pod1_umbrella: Int
@CCall(id = "knifunptr_pod12_pod1_umbrella_getter") get
@CCall(id = "knifunptr_pod13_pod1_umbrella_setter") set
}
@@ -0,0 +1,5 @@
language = C
headers=pod1/pod1-umbrella.h
headerFilter=**
excludeFilter=pod1/pod1.h
@@ -0,0 +1,7 @@
package pod1 {
var pod1A: Int
@CCall(id = "knifunptr_pod10_pod1A_getter") get
@CCall(id = "knifunptr_pod11_pod1A_setter") set
}
@@ -0,0 +1,5 @@
language = C
headers=pod1/pod1-umbrella.h
headerFilter=pod1/pod1-umbrella.h pod1/pod1A.h
excludeFilter=pod1/pod1-umbrella.h
@@ -0,0 +1,7 @@
package pod1 {
var pod1: Int
@CCall(id = "knifunptr_pod10_pod1_getter") get
@CCall(id = "knifunptr_pod11_pod1_setter") set
}
@@ -0,0 +1,4 @@
language = C
headers=pod1/pod1-umbrella.h
headerFilter=pod1/pod1.h
@@ -0,0 +1,7 @@
package pod1 {
var pod1A: Int
@CCall(id = "knifunptr_pod10_pod1A_getter") get
@CCall(id = "knifunptr_pod11_pod1A_setter") set
}
@@ -0,0 +1,4 @@
language = C
headers=pod1/pod1-umbrella.h
headerFilter=pod1/pod1A.h
@@ -0,0 +1,7 @@
package pod1 {
var pod1_umbrella: Int
@CCall(id = "knifunptr_pod10_pod1_umbrella_getter") get
@CCall(id = "knifunptr_pod11_pod1_umbrella_setter") set
}
@@ -0,0 +1,4 @@
language = C
headers=pod1/pod1-umbrella.h
headerFilter=pod1/pod1-umbrella.h
@@ -0,0 +1,10 @@
package pod1 {
var pod1A: Int
@CCall(id = "knifunptr_pod10_pod1A_getter") get
@CCall(id = "knifunptr_pod11_pod1A_setter") set
var pod1_umbrella: Int
@CCall(id = "knifunptr_pod12_pod1_umbrella_getter") get
@CCall(id = "knifunptr_pod13_pod1_umbrella_setter") set
}
@@ -0,0 +1,4 @@
language = C
headers=pod1/pod1-umbrella.h
headerFilter=pod1/pod1-umbrella.h pod1/pod1A.h
@@ -0,0 +1,13 @@
package pod1 {
var pod1: Int
@CCall(id = "knifunptr_pod10_pod1_getter") get
@CCall(id = "knifunptr_pod11_pod1_setter") set
var pod1A: Int
@CCall(id = "knifunptr_pod12_pod1A_getter") get
@CCall(id = "knifunptr_pod13_pod1A_setter") set
var pod1_umbrella: Int
@CCall(id = "knifunptr_pod14_pod1_umbrella_getter") get
@CCall(id = "knifunptr_pod15_pod1_umbrella_setter") set
}
@@ -0,0 +1,2 @@
language = C
headers=pod1/pod1-umbrella.h
@@ -0,0 +1,13 @@
package pod1 {
var podImportsAngleAngle: Int
@CCall(id = "knifunptr_pod10_podImportsAngleAngle_getter") get
@CCall(id = "knifunptr_pod11_podImportsAngleAngle_setter") set
var podImportsAngleAngleA: Int
@CCall(id = "knifunptr_pod12_podImportsAngleAngleA_getter") get
@CCall(id = "knifunptr_pod13_podImportsAngleAngleA_setter") set
var podImportsAngleAngle_umbrella: Int
@CCall(id = "knifunptr_pod14_podImportsAngleAngle_umbrella_getter") get
@CCall(id = "knifunptr_pod15_podImportsAngleAngle_umbrella_setter") set
}
@@ -0,0 +1,2 @@
language = Objective-C
modules = podImportsAngleAngle
@@ -0,0 +1,13 @@
package pod1 {
var podImportsAngleQuote: Int
@CCall(id = "knifunptr_pod10_podImportsAngleQuote_getter") get
@CCall(id = "knifunptr_pod11_podImportsAngleQuote_setter") set
var podImportsAngleQuoteA: Int
@CCall(id = "knifunptr_pod12_podImportsAngleQuoteA_getter") get
@CCall(id = "knifunptr_pod13_podImportsAngleQuoteA_setter") set
var podImportsAngleQuote_umbrella: Int
@CCall(id = "knifunptr_pod14_podImportsAngleQuote_umbrella_getter") get
@CCall(id = "knifunptr_pod15_podImportsAngleQuote_umbrella_setter") set
}
@@ -0,0 +1,2 @@
language = Objective-C
modules = podImportsAngleQuote
@@ -0,0 +1,13 @@
package pod1 {
var podImportsQuoteAngle: Int
@CCall(id = "knifunptr_pod10_podImportsQuoteAngle_getter") get
@CCall(id = "knifunptr_pod11_podImportsQuoteAngle_setter") set
var podImportsQuoteAngleA: Int
@CCall(id = "knifunptr_pod12_podImportsQuoteAngleA_getter") get
@CCall(id = "knifunptr_pod13_podImportsQuoteAngleA_setter") set
var podImportsQuoteAngle_umbrella: Int
@CCall(id = "knifunptr_pod14_podImportsQuoteAngle_umbrella_getter") get
@CCall(id = "knifunptr_pod15_podImportsQuoteAngle_umbrella_setter") set
}
@@ -0,0 +1,2 @@
language = Objective-C
modules = podImportsQuoteAngle
@@ -0,0 +1,13 @@
package pod1 {
var podImportsQuoteQuote: Int
@CCall(id = "knifunptr_pod10_podImportsQuoteQuote_getter") get
@CCall(id = "knifunptr_pod11_podImportsQuoteQuote_setter") set
var podImportsQuoteQuoteA: Int
@CCall(id = "knifunptr_pod12_podImportsQuoteQuoteA_getter") get
@CCall(id = "knifunptr_pod13_podImportsQuoteQuoteA_setter") set
var podImportsQuoteQuote_umbrella: Int
@CCall(id = "knifunptr_pod14_podImportsQuoteQuote_umbrella_getter") get
@CCall(id = "knifunptr_pod15_podImportsQuoteQuote_umbrella_setter") set
}
@@ -0,0 +1,2 @@
language = Objective-C
modules = podImportsQuoteQuote
@@ -0,0 +1,13 @@
package pod1 {
var pod1: Int
@CCall(id = "knifunptr_pod10_pod1_getter") get
@CCall(id = "knifunptr_pod11_pod1_setter") set
var pod1A: Int
@CCall(id = "knifunptr_pod12_pod1A_getter") get
@CCall(id = "knifunptr_pod13_pod1A_setter") set
var pod1_umbrella: Int
@CCall(id = "knifunptr_pod14_pod1_umbrella_getter") get
@CCall(id = "knifunptr_pod15_pod1_umbrella_setter") set
}
@@ -0,0 +1,2 @@
language = Objective-C
modules = pod1

Some files were not shown because too many files have changed in this diff Show More