Skip to content

Commit 8b758b0

Browse files
authored
Merge pull request #843 from artemcm/WorkaroundClangCodePathEMB
[Explicit Module Builds] Use new form of `-fmodule-file` to work around Clang issue with explicit builds and emit-PCH
2 parents c5f11e5 + 3017226 commit 8b758b0

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)