Fix direct clang cc1 emit-pcm commands with vfs overlay on Windows (#85325)

Explicit module builds currently fail on Windows because
direct-clang-cc1-module-build emit-pcm commands take overlaid system
module map files as inputs but miss the clang VFS overlay. This change
adds the overlay and fixes explicit module builds on Windows.
This commit is contained in:
Hiroshi Yamauchi
2025-11-12 21:03:15 -08:00
committed by GitHub
parent 2db0e8aea8
commit a96b57de17
6 changed files with 87 additions and 16 deletions

View File

@@ -1992,6 +1992,14 @@ ModuleDependencyInfo ModuleDependencyScanner::bridgeClangModuleDependency(
}
}
// Pass the -sdk flag to make the system header VFS overlay finable
// for the -direct-clang-cc1-module-build emit-pcm command on Windows.
StringRef SDKPath = ScanASTContext.SearchPathOpts.getSDKPath();
if (!SDKPath.empty()) {
swiftArgs.push_back("-sdk");
swiftArgs.push_back(SDKPath.str());
}
// Add args reported by the scanner.
auto clangArgs = invocation.getCC1CommandLine();
llvm::for_each(clangArgs, addClangArg);