diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/CAdapterGenerator.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/CAdapterGenerator.kt index 1a2a18dc4cc..8b1d7c70daa 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/CAdapterGenerator.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/CAdapterGenerator.kt @@ -763,7 +763,11 @@ internal class CAdapterGenerator(val context: Context) : DeclarationDescriptorVi } } + private fun ExportedElementScope.hasNonEmptySubScopes(): Boolean = elements.isNotEmpty() || scopes.any { it.hasNonEmptySubScopes() } + private fun makeScopeDefinitions(scope: ExportedElementScope, kind: DefinitionKind, indent: Int) { + if (!scope.hasNonEmptySubScopes()) + return if (kind == DefinitionKind.C_HEADER_STRUCT) output("struct {", indent) if (kind == DefinitionKind.C_SOURCE_STRUCT) output(".${scope.name} = {", indent) scope.elements.forEach { makeElementDefinition(it, kind, indent + 1) }