Skip to content

Commit 221b5ea

Browse files
authored
Merge pull request #1348 from apple/revert-1346-OnlySourceForWMOSupplements
2 parents 7831d39 + ea98a20 commit 221b5ea

File tree

2 files changed

+1
-25
lines changed

2 files changed

+1
-25
lines changed

Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -585,10 +585,7 @@ extension Driver {
585585
// To match the legacy driver behavior, make sure we add the first input file
586586
// to the output file map if compiling without primary inputs (WMO), even
587587
// if there aren't any corresponding outputs.
588-
guard let firstSourceInputHandle = inputFiles.first(where:{ $0.type == .swift })?.fileHandle else {
589-
fatalError("Formulating swift-frontend invocation without any input .swift files")
590-
}
591-
entries[firstSourceInputHandle] = [:]
588+
entries[inputFiles[0].fileHandle] = [:]
592589
}
593590

594591
for flaggedPair in flaggedInputOutputPairs {

Tests/SwiftDriverTests/SwiftDriverTests.swift

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2824,27 +2824,6 @@ final class SwiftDriverTests: XCTestCase {
28242824

28252825
}
28262826

2827-
func testWMOWithNonSourceInput() throws {
2828-
var driver1 = try Driver(args: [
2829-
"swiftc", "-whole-module-optimization", "danger.o", "foo.swift", "bar.swift", "wibble.swift", "-module-name", "Test",
2830-
"-driver-filelist-threshold=0"
2831-
])
2832-
let plannedJobs = try driver1.planBuild().removingAutolinkExtractJobs()
2833-
XCTAssertEqual(plannedJobs.count, 2)
2834-
let compileJob = plannedJobs[0]
2835-
XCTAssertEqual(compileJob.kind, .compile)
2836-
XCTAssert(compileJob.commandLine.contains(.flag("-supplementary-output-file-map")))
2837-
let argIdx = try XCTUnwrap(compileJob.commandLine.firstIndex(where: { $0 == .flag("-supplementary-output-file-map") }))
2838-
let supplOutputs = compileJob.commandLine[argIdx+1]
2839-
guard case let .path(path) = supplOutputs,
2840-
case let .fileList(_, fileList) = path,
2841-
case let .outputFileMap(outFileMap) = fileList else {
2842-
throw StringError("Unexpected argument for output file map")
2843-
}
2844-
let firstKey: String = try VirtualPath.lookup(XCTUnwrap(outFileMap.entries.keys.first)).description
2845-
XCTAssertEqual(firstKey, "foo.swift")
2846-
}
2847-
28482827
func testDashDashPassingDownInput() throws {
28492828
do {
28502829
var driver = try Driver(args: ["swiftc", "-module-name=ThisModule", "-wmo", "-num-threads", "4", "-emit-module", "-o", "test.swiftmodule", "--", "main.swift", "multi-threaded.swift"])

0 commit comments

Comments
 (0)