Skip to content

Commit d5c60fe

Browse files
committed
SwiftDriver: repair the generation of CodeView debug info
Correct the spelling for the argument for the `-debug-info-format`. We were incorrectly emitting the enum name instead of the value, which would break the build when CodeView was enabled.
1 parent 2d86693 commit d5c60fe

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ extension Driver {
196196
try commandLine.appendLast(.enablePrivateImports, from: &parsedOptions)
197197
try commandLine.appendLast(in: .g, from: &parsedOptions)
198198
if debugInfo.level != nil {
199-
commandLine.appendFlag("-debug-info-format=\(debugInfo.format)")
199+
commandLine.appendFlag("-debug-info-format=\(debugInfo.format.rawValue)")
200200
if isFrontendArgSupported(.dwarfVersion) {
201201
commandLine.appendFlag("-dwarf-version=\(debugInfo.dwarfVersion)")
202202
}

Tests/SwiftDriverTests/SwiftDriverTests.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,16 @@ final class SwiftDriverTests: XCTestCase {
560560
try assertNoDriverDiagnostics(args: "swiftc", "foo.swift", "-emit-module", "-g", "-debug-info-format=codeview") { driver in
561561
XCTAssertEqual(driver.debugInfo.level, .astTypes)
562562
XCTAssertEqual(driver.debugInfo.format, .codeView)
563+
564+
let jobs = try driver.planBuild()
565+
XCTAssertTrue(jobs[0].commandLine.contains(.flag("-debug-info-format=codeview")))
566+
}
567+
568+
try assertNoDriverDiagnostics(args: "swiftc", "foo.swift", "-emit-module", "-g", "-debug-info-format=dwarf") { driver in
569+
XCTAssertEqual(driver.debugInfo.format, .dwarf)
570+
571+
let jobs = try driver.planBuild()
572+
XCTAssertTrue(jobs[0].commandLine.contains(.flag("-debug-info-format=dwarf")))
563573
}
564574

565575
try assertDriverDiagnostics(args: "swiftc", "foo.swift", "-emit-module", "-debug-info-format=dwarf") {

0 commit comments

Comments
 (0)