Skip to content

Commit 3017226

Browse files
committed
[Explicit Module Builds] Use new form of -fmodule-file to work around Clang issue with explicit builds and emit-PCH
This form causes Swift's underlying Clang invocation to take different code-paths when loading pre-built PCM dependencies, which is not affected on whether the compiler is in emit-pre-built-header mode. Workaround for rdar://83309762
1 parent f1761dc commit 3017226

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Sources/SwiftDriver/ExplicitModuleBuilds/ExplicitDependencyBuildPlanner.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ public typealias ExternalTargetModuleDetailsMap = [ModuleDependencyId: ExternalT
288288
TypedVirtualPath(file: moduleArtifactInfo.moduleMapPath.path,
289289
type: .clangModuleMap)
290290
commandLine.appendFlags("-Xcc", "-Xclang", "-Xcc",
291-
"-fmodule-file=\(clangModulePath.file.description)")
291+
"-fmodule-file=\(moduleArtifactInfo.moduleName)=\(clangModulePath.file.description)")
292292
commandLine.appendFlags("-Xcc", "-Xclang", "-Xcc",
293293
"-fmodule-map-file=\(clangModuleMapPath.file.description)")
294294
inputs.append(clangModulePath)

Tests/SwiftDriverTests/ExplicitModuleBuildTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ private func checkExplicitModuleBuildJobDependencies(job: Job,
128128
XCTAssertTrue(job.inputs.contains(clangDependencyModulePath))
129129
XCTAssertTrue(job.inputs.contains(clangDependencyModuleMapPath))
130130
XCTAssertTrue(job.commandLine.contains(
131-
.flag(String("-fmodule-file=\(clangDependencyModulePathString)"))))
131+
.flag(String("-fmodule-file=\(dependencyId.moduleName)=\(clangDependencyModulePathString)"))))
132132
XCTAssertTrue(job.commandLine.contains(
133133
.flag(String("-fmodule-map-file=\(clangDependencyDetails.moduleMapPath.path.description)"))))
134134
case .swiftPlaceholder(_):

0 commit comments

Comments
 (0)