Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@ extension Driver {

// Pass down -clang-target.
// If not specified otherwise, we should use the same triple as -target
// TODO: enable -clang-target for implicit module build as well.
if !parsedOptions.hasArgument(.disableClangTarget) &&
isFrontendArgSupported(.clangTarget) {
isFrontendArgSupported(.clangTarget) &&
parsedOptions.contains(.driverExplicitModuleBuild) {
let clangTriple = parsedOptions.getLastArgument(.clangTarget)?.asSingle ?? targetTriple.triple
commandLine.appendFlag(.clangTarget)
commandLine.appendFlag(clangTriple)
Expand Down
4 changes: 2 additions & 2 deletions Tests/SwiftDriverTests/SwiftDriverTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3622,7 +3622,7 @@ final class SwiftDriverTests: XCTestCase {
#endif
}

func testEnableClangTargetForImplicitModule() throws {
func testDisableClangTargetForImplicitModule() throws {
var envVars = ProcessEnv.vars
envVars["SWIFT_DRIVER_LD_EXEC"] = ld.nativePathString(escaped: false)

Expand All @@ -3632,7 +3632,7 @@ final class SwiftDriverTests: XCTestCase {
let plannedJobs = try driver.planBuild()
XCTAssertEqual(plannedJobs.count, 2)
XCTAssert(plannedJobs[0].commandLine.contains(.flag("-target")))
XCTAssertTrue(plannedJobs[0].commandLine.contains(.flag("-clang-target")))
XCTAssertFalse(plannedJobs[0].commandLine.contains(.flag("-clang-target")))
}

func testPCHasCompileInput() throws {
Expand Down