Skip to content

Commit 798bca8

Browse files
committed
Fix Interface missing type list of opaque type
1 parent 6538345 commit 798bca8

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,6 @@ swift-section interface /path/to/binary
217217

218218
# Save interface to file
219219
swift-section interface --output-path interface.swift /path/to/binary
220-
221-
# Enable type indexing for better interface generation
222-
swift-section interface --enable-type-indexing /path/to/binary
223-
224-
# Use color scheme for console output
225-
swift-section interface --color-scheme light /path/to/binary
226220
```
227221

228222
## License

Sources/Demangling/Main/NodePrinter/NodePrinter.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,10 +1109,11 @@ package struct NodePrinter<Target: NodePrinterTarget>: Sendable {
11091109
}
11101110

11111111
private mutating func printOpaqueType(_ name: Node) {
1112-
printFirstChild(name)
1113-
target.write(".")
1114-
_ = printOptional(name.children.at(1))
1115-
_ = printOptional(name.children.at(2))
1112+
// printFirstChild(name)
1113+
// target.write(".")
1114+
// _ = printOptional(name.children.at(1))
1115+
// _ = printOptional(name.children.at(2))
1116+
printChildren(name, separator: ".")
11161117
}
11171118

11181119
private mutating func printImplInvocationsSubstitutions(_ name: Node) {

Sources/SwiftInterface/NodePrintables/TypeNodePrintable.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ extension TypeNodePrintable {
5151
}
5252

5353
mutating func printOpaqueType(_ name: Node) {
54-
printFirstChild(name)
54+
// printFirstChild(name)
55+
printOptional(name[safeChild: 2])
5556
}
5657

5758
mutating func printType(_ name: Node) {

Sources/swift-section/Commands/InterfaceCommand.swift

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ struct InterfaceCommand: AsyncParsableCommand {
1111
abstract: "Generate Swift interface from a Mach-O file."
1212
)
1313

14-
@Argument(help: "The output path for the dump. If not specified, the output will be printed to the console.", completion: .file())
15-
var outputPath: String
16-
1714
@OptionGroup
1815
var machOOptions: MachOOptionGroup
1916

17+
@Option(name: .shortAndLong, help: "The output path for the dump. If not specified, the output will be printed to the console.", completion: .file())
18+
var outputPath: String?
19+
2020
@Flag(help: "Show imported C types in the generated Swift interface.")
2121
var showCImportedTypes: Bool = false
2222

@@ -37,8 +37,12 @@ struct InterfaceCommand: AsyncParsableCommand {
3737

3838
print("Swift interface built successfully.")
3939

40-
print("Writing Swift interface to \(outputPath)...")
41-
let outputURL = URL(fileURLWithPath: outputPath)
42-
try interfaceString.string.write(to: outputURL, atomically: true, encoding: .utf8)
40+
if let outputPath {
41+
print("Writing Swift interface to \(outputPath)...")
42+
let outputURL = URL(fileURLWithPath: outputPath)
43+
try interfaceString.string.write(to: outputURL, atomically: true, encoding: .utf8)
44+
} else {
45+
print(interfaceString.string)
46+
}
4347
}
4448
}

Tests/SwiftDumpTests/DyldCacheDumpTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import MachOFoundation
88
@testable import MachOTestingSupport
99

1010
@Suite(.serialized)
11-
final class DyldCacheDumpTests: DyldCacheTests, DumpableTests {
11+
final class DyldCacheDumpTests: DyldCacheTests, DumpableTests, @unchecked Sendable {
1212
override class var cacheImageName: MachOImageName { .SwiftUICore }
1313
}
1414

Tests/SwiftInterfaceTests/SwiftInterfaceBuilderTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ enum SwiftInterfaceBuilderTestSuite {
6565

6666
override class var cacheImageName: MachOImageName { .SwiftUI }
6767

68-
override class var cachePath: DyldSharedCachePath { .macOS_15_5 }
68+
override class var cachePath: DyldSharedCachePath { .iOS_18_5 }
6969

7070
@Test func buildFile() async throws {
7171
try await buildFile(in: machOFileInCache)

0 commit comments

Comments
 (0)