mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This mode is similar to `swift-symbolgraph-extract`; it takes a subset of compiler flags to configure the invocation for module loading, as well as a module name whose contents should be extracted. It does not take any other input files. The output is a single text file specified by `-o` (or `stdout` if not specified). While the most common use case for this would be viewing the synthesized Swift interface for a Clang module, since the implementation simply calls `swift::ide::printModuleInterface` under the hood, it's usable for any module that Swift can import. Thus, it could also be used to view a synthesized textual representation of, say, a compiled `.swiftmodule`. One could imagine that in the future, we might add more flags to `swift-synthesize-interface` to modify various `PrintOptions` used when generating the output, if we think those would be useful.
16 lines
597 B
Swift
16 lines
597 B
Swift
// Emit the explicit module.
|
|
// RUN: %empty-directory(%t)
|
|
// RUN: %target-swift-emit-pcm -module-name m1 -o %t/m1.pcm %S/Inputs/module.modulemap
|
|
|
|
// Invoke the frontend with the PCM as an input.
|
|
// RUN: %target-swift-synthesize-interface %windows_vfs_overlay_opt -module-name m1 -Xcc -fmodule-file=%t/m1.pcm -o - | %FileCheck %s
|
|
|
|
// CHECK: public struct MyStruct {
|
|
// CHECK-DAG: public init()
|
|
// CHECK-DAG: public init(value: Int32)
|
|
// CHECK-DAG: public var value: Int32
|
|
// CHECK-DAG: }
|
|
// CHECK-DAG: extension MyStruct {
|
|
// CHECK-DAG: public func printValue()
|
|
// CHECK-DAG: }
|