Skip to content

Commit 8551f9e

Browse files
committed
Restore the Printing of Bitstream Fields
1 parent 875fba3 commit 8551f9e

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

Sources/TSCUtility/Bitstream.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,21 @@ public enum BitcodeElement {
4747
case record(Record)
4848
}
4949

50+
extension BitcodeElement.Record.Payload: CustomStringConvertible {
51+
public var description: String {
52+
switch self {
53+
case .none:
54+
return "none"
55+
case .array(let vals):
56+
return "array(\(vals))"
57+
case .char6String(let s):
58+
return "char6String(\(s))"
59+
case .blob(let s):
60+
return "blob(\(s.count) bytes)"
61+
}
62+
}
63+
}
64+
5065
public struct BlockInfo {
5166
public var name: String = ""
5267
public var recordNames: [UInt64: String] = [:]

Tests/TSCUtilityTests/BitstreamTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ final class BitstreamTests: XCTestCase {
2929
}
3030

3131
mutating func visit(record: BitcodeElement.Record) throws {
32-
log.append("Record (id: \(record.id), fields: \(record.fields), payload: \(record.payload)")
32+
log.append("Record (id: \(record.id), fields: \(Array(record.fields)), payload: \(record.payload)")
3333
}
3434
}
3535

0 commit comments

Comments
 (0)