Files
swift-mirror/test/Interop/SwiftToCxx/class/nested-classes-in-cxx.swift
Gabor Horvath 616de41526 [cxx-interop] Fix nested structs for non-opaque types
The test for nested constructs used library evolution forcing all types
to be opaque. As a result some code paths for non-opaque types were not
updated to support nested types. This patch updates the rest of the code
making sure we use fully qualified names (so they also work in the
context of the nested classes), and generate correct names for the C
compatibility structs that cannot contain "::".

Fixes #80291

rdar://147882976
2025-04-03 15:30:01 +01:00

39 lines
1.2 KiB
Swift

// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend %s -enable-library-evolution -typecheck -module-name Classes -clang-header-expose-decls=all-public -emit-clang-header-path %t/classes.h
// RUN: %check-interop-cxx-header-in-clang(%t/classes.h -DSWIFT_CXX_INTEROP_HIDE_STL_OVERLAY -std=c++17)
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend %s -typecheck -module-name Classes -clang-header-expose-decls=all-public -emit-clang-header-path %t/classes.h
// RUN: %check-interop-cxx-header-in-clang(%t/classes.h -DSWIFT_CXX_INTEROP_HIDE_STL_OVERLAY -std=c++17)
public class RecordConfig {
public enum AudioFormat {
case PCM, ALAC, AAC
}
public struct Directory {
public var path: String?
}
public class File {
public var format: AudioFormat = .ALAC
public class Gate {
public init() {}
public var prop: Int32 = 80
public func computeValue() -> Int32 {
return prop * 2
}
}
}
public var directory = Directory()
public var file = File()
public var gate = File.Gate()
}
public func makeRecordConfig() -> RecordConfig {
return RecordConfig()
}