From 8bd0bb63c9c0c43730f0ca1292ed983775a0bdf9 Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Fri, 14 Jul 2017 17:57:54 +0300 Subject: [PATCH] Remove obsolete workarounds for *va_list* in interop Fix #740 --- .../kotlin/native/interop/indexer/Indexer.kt | 31 ------------------- 1 file changed, 31 deletions(-) diff --git a/Interop/Indexer/src/main/kotlin/org/jetbrains/kotlin/native/interop/indexer/Indexer.kt b/Interop/Indexer/src/main/kotlin/org/jetbrains/kotlin/native/interop/indexer/Indexer.kt index 181b9efb608..dd8e46170f5 100644 --- a/Interop/Indexer/src/main/kotlin/org/jetbrains/kotlin/native/interop/indexer/Indexer.kt +++ b/Interop/Indexer/src/main/kotlin/org/jetbrains/kotlin/native/interop/indexer/Indexer.kt @@ -137,43 +137,12 @@ internal class NativeIndexImpl(val library: NativeLibrary) : NativeIndex() { } } - private fun builtinVaListType(type: CValue, name: String, underlying: Type): Type { - assert (type.kind == CXType_Typedef) - val declarationId = DeclarationID("c:@T@$name") - - val structDeclaration = structById.getOrPut(declarationId) { - StructDeclImpl(name).apply { - val size = clang_Type_getSizeOf(type) - val align = clang_Type_getAlignOf(type).toInt() - val def = StructDefImpl(size, align, this, hasNaturalLayout = false) - this.def = def - } - } - assert (underlying is ConstArrayType) - // So the result must feel like array: - return ConstArrayType(RecordType(structDeclaration), 1) - } - fun getTypedef(type: CValue): Type { val declCursor = clang_getTypeDeclaration(type) val name = getCursorSpelling(declCursor) val underlying = convertType(clang_getTypedefDeclUnderlyingType(declCursor)) - if (name == "__builtin_va_list" && underlying is ConstArrayType) { - // On some platforms (e.g. macOS) libclang reports `__builtin_va_list` to be defined as array using - // typedef struct __va_list_tag __builtin_va_list[1] - // while `struct __va_list_tag` is incomplete. - // So `__builtin_va_list` gets declared as incorrect type, and requires some dirty hacks: - return builtinVaListType(type, name, underlying) - } - - - if (name == "__gnuc_va_list" || name == "va_list" || name == "__va_list") { - // TODO: fix GNUC varargs support. - return UnsupportedType - } - if ((underlying is RecordType && underlying.decl.spelling.split(' ').last() == name) || (underlying is EnumType && underlying.def.spelling.split(' ').last() == name)) {