Skip to content

Commit caafc82

Browse files
committed
Pass down the no-verify flag to the frontend invocations
The flag -no-verify-emitted-module-interface tells the driver to skip verifying the swiftinterfaces emitted by the compiler. Let's pass it down to the frontend as well and so it can write it down in the skipped swiftinterface. This will help understand them from the reader side. rdar://120445669
1 parent 2f9f641 commit caafc82

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,15 @@ extension Driver {
420420
}
421421
}
422422

423+
// Pass along -no-verify-emitted-module-interface only if it's effective.
424+
// Assume verification by default as we want to know only when the user skips
425+
// the verification.
426+
if !parsedOptions.hasFlag(positive: .verifyEmittedModuleInterface,
427+
negative: .noVerifyEmittedModuleInterface,
428+
default: true) {
429+
commandLine.appendFlag("-no-verify-emitted-module-interface")
430+
}
431+
423432
// Repl Jobs shouldn't include -module-name.
424433
if compilerMode != .repl && compilerMode != .intro {
425434
commandLine.appendFlags("-module-name", moduleOutputInfo.name)

Tests/SwiftDriverTests/SwiftDriverTests.swift

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5590,6 +5590,8 @@ final class SwiftDriverTests: XCTestCase {
55905590
"-no-verify-emitted-module-interface"], env: envVars)
55915591
let plannedJobs = try driver.planBuild()
55925592
XCTAssertEqual(plannedJobs.count, 2)
5593+
let emitJob = try plannedJobs.findJob(.emitModule)
5594+
XCTAssertTrue(emitJob.commandLine.contains("-no-verify-emitted-module-interface"))
55935595
}
55945596

55955597
// Disabled by default in merge-module
@@ -5628,6 +5630,8 @@ final class SwiftDriverTests: XCTestCase {
56285630
XCTAssertTrue(verifyJob.inputs.count == 1)
56295631
XCTAssertTrue(verifyJob.inputs[0] == emitInterfaceOutput[0])
56305632
XCTAssertTrue(verifyJob.commandLine.contains(.path(emitInterfaceOutput[0].file)))
5633+
XCTAssertFalse(emitJob.commandLine.contains("-no-verify-emitted-module-interface"))
5634+
XCTAssertFalse(emitJob.commandLine.contains("-verify-emitted-module-interface"))
56315635
}
56325636

56335637
// Whole-module
@@ -5650,6 +5654,19 @@ final class SwiftDriverTests: XCTestCase {
56505654
XCTAssertTrue(verifyJob.commandLine.contains(.path(emitInterfaceOutput[0].file)))
56515655
}
56525656

5657+
// Test the `-no-verify-emitted-module-interface` flag with whole-module
5658+
do {
5659+
var driver = try Driver(args: ["swiftc", "foo.swift", "-emit-module", "-module-name",
5660+
"foo", "-emit-module-interface",
5661+
"-enable-library-evolution",
5662+
"-whole-module-optimization",
5663+
"-no-verify-emitted-module-interface"], env: envVars)
5664+
let plannedJobs = try driver.planBuild()
5665+
XCTAssertEqual(plannedJobs.count, 1)
5666+
let compileJob = try plannedJobs.findJob(.compile)
5667+
XCTAssertTrue(compileJob.commandLine.contains("-no-verify-emitted-module-interface"))
5668+
}
5669+
56535670
// Enabled by default when the library-level is api.
56545671
do {
56555672
var driver = try Driver(args: ["swiftc", "foo.swift", "-emit-module", "-module-name",
@@ -5672,6 +5689,8 @@ final class SwiftDriverTests: XCTestCase {
56725689
let plannedJobs = try driver.planBuild()
56735690
XCTAssertEqual(plannedJobs.count, 1)
56745691
XCTAssertEqual(plannedJobs[0].kind, .compile)
5692+
let compileJob = try plannedJobs.findJob(.compile)
5693+
XCTAssertFalse(compileJob.commandLine.contains("-no-verify-emitted-module-interface"))
56755694
}
56765695

56775696
// The flag -check-api-availability-only is not passed down to the verify job.

0 commit comments

Comments
 (0)