Skip to content

Commit 136c2ee

Browse files
committed
Emit-module separately: Pass on the -parse-as-library flag to the frontend
rdar://74713625
1 parent 709bba0 commit 136c2ee

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

Sources/SwiftDriver/Jobs/EmitModuleJob.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ extension Driver {
7676

7777
addCommonModuleOptions(commandLine: &commandLine, outputs: &outputs, isMergeModule: false)
7878

79+
if parsedOptions.hasArgument(.parseAsLibrary, .emitLibrary) {
80+
commandLine.appendFlag(.parseAsLibrary)
81+
}
82+
7983
commandLine.appendFlag(.o)
8084
commandLine.appendPath(moduleOutputPath)
8185

Tests/SwiftDriverTests/SwiftDriverTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1817,6 +1817,7 @@ final class SwiftDriverTests: XCTestCase {
18171817
let plannedJobs = try driver.planBuild()
18181818
XCTAssertEqual(plannedJobs.count, 4)
18191819
XCTAssertTrue(plannedJobs[0].tool.name.contains("swift"))
1820+
XCTAssertTrue(plannedJobs[0].commandLine.contains(.flag("-parse-as-library")))
18201821
XCTAssertEqual(plannedJobs[0].outputs.count, 3)
18211822
XCTAssertEqual(plannedJobs[0].outputs[0].file, .absolute(AbsolutePath("/foo/bar/Test.swiftmodule")))
18221823
XCTAssertEqual(plannedJobs[0].outputs[1].file, .absolute(AbsolutePath("/foo/bar/Test.swiftdoc")))

0 commit comments

Comments
 (0)