From 4ac29dff3719ed29916b7259e242126d97b48394 Mon Sep 17 00:00:00 2001 From: Hamish Knight Date: Mon, 15 Jul 2024 10:26:23 +0100 Subject: [PATCH] Pass through `-module-abi-name` to frontend Match the legacy driver and add `-module-abi-name` as a common frontend option. --- Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift | 1 + Tests/SwiftDriverTests/SwiftDriverTests.swift | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift b/Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift index d33fb9761..30fb90560 100644 --- a/Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift +++ b/Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift @@ -212,6 +212,7 @@ extension Driver { try commandLine.appendLast(.importUnderlyingModule, from: &parsedOptions) try commandLine.appendLast(.moduleCachePath, from: &parsedOptions) try commandLine.appendLast(.moduleLinkName, from: &parsedOptions) + try commandLine.appendLast(.moduleAbiName, from: &parsedOptions) try commandLine.appendLast(.nostdimport, from: &parsedOptions) try commandLine.appendLast(.parseStdlib, from: &parsedOptions) try commandLine.appendLast(.solverMemoryThreshold, from: &parsedOptions) diff --git a/Tests/SwiftDriverTests/SwiftDriverTests.swift b/Tests/SwiftDriverTests/SwiftDriverTests.swift index 41343dba1..03a61ec5c 100644 --- a/Tests/SwiftDriverTests/SwiftDriverTests.swift +++ b/Tests/SwiftDriverTests/SwiftDriverTests.swift @@ -827,6 +827,16 @@ final class SwiftDriverTests: XCTestCase { } } + func testModuleABIName() throws { + var driver = try Driver( + args: ["swiftc", "foo.swift", "-module-name", "Mod", "-module-abi-name", "ABIMod"] + ) + let jobs = try driver.planBuild() + let compileJob = try jobs.findJob(.compile) + XCTAssert(compileJob.commandLine.contains(.flag("-module-abi-name"))) + XCTAssert(compileJob.commandLine.contains(.flag("ABIMod"))) + } + func testStandardCompileJobs() throws { var driver1 = try Driver(args: ["swiftc", "foo.swift", "bar.swift", "-module-name", "Test"]) let plannedJobs = try driver1.planBuild().removingAutolinkExtractJobs()