Files
swift-mirror/test/SynthesizeInterfaceTool/include-submodules.swift
Tony Allevato 0d7bc4d0f5 [Frontend] Add some printing/vistation options to swift-synthesize-interface.
The `-include-submodules` flag causes the synthesized interface to include
implicit Clang submodules of the module being printed. Since these are
automatically made visible when importing the corresponding top-level module,
it's often useful to have them present in the same synthesized Swift
interface instead of having to make separate invocations to get each
submodule separately.

The `-print-fully-qualified-types` causes type names to be printed with
full module qualification. This is useful when using the synthesized
interface for some other kind of analysis, because it ensures that all
type references explicitly indicate which module they came from, instead
of having to guess scoping and import resolution rules to figure out
which module a reference comes from.
2024-11-12 20:17:35 -05:00

40 lines
1.6 KiB
Swift

// RUN: %target-swift-synthesize-interface -module-name TopLevelModule -I %S/Inputs -o - | %FileCheck %s
// RUN: %target-swift-synthesize-interface -module-name TopLevelModule -include-submodules -I %S/Inputs -o - | %FileCheck %s --check-prefix=IMPLICIT
// RUN: %target-swift-synthesize-interface -module-name TopLevelModule.ExplicitSubmodule -I %S/Inputs -o - | %FileCheck %s --check-prefix=EXPLICIT
// CHECK: import TopLevelModule.ExplicitSubmodule
// CHECK-DAG: import TopLevelModule.ImplicitSubmodule
// CHECK-DAG: public struct TopLevelModuleStruct {
// CHECK-DAG: public init()
// CHECK-DAG: public init(value: Int32)
// CHECK-DAG: public var value: Int32
// CHECK-DAG: }
// CHECK-NOT: ImplicitModuleStruct
// CHECK-NOT: ExplicitModuleStruct
// IMPLICIT: import TopLevelModule.ExplicitSubmodule
// IMPLICIT-DAG: import TopLevelModule.ImplicitSubmodule
// IMPLICIT-DAG: public struct TopLevelModuleStruct {
// IMPLICIT-DAG: public init()
// IMPLICIT-DAG: public init(value: Int32)
// IMPLICIT-DAG: public var value: Int32
// IMPLICIT-DAG: }
// IMPLICIT-DAG: public struct ImplicitSubmoduleStruct {
// IMPLICIT-DAG: public init()
// IMPLICIT-DAG: public init(value: Int32)
// IMPLICIT-DAG: public var value: Int32
// IMPLICIT-DAG: }
// IMPLICIT-NOT: ExplicitSubmoduleStruct
// EXPLICIT: public struct ExplicitSubmoduleStruct {
// EXPLICIT-DAG: public init()
// EXPLICIT-DAG: public init(value: Int32)
// EXPLICIT-DAG: public var value: Int32
// EXPLICIT-DAG: }
// EXPLICIT-NOT: import TopLevelModule{{.*}}
// EXPLICIT-NOT: TopLevelModuleStruct
// EXPLICIT-NOT: ImplicitModuleStruct