[Dependency Scanning] Do now write out bridging header dependencies of binary modules unless in CAS mode

We only record these dependencies in CAS mode, because we require explicit PCH tasks to be produced for imported header of binary module dependencies. In the meantime, in non-CAS mode loading clients will consume the `.h` files encoded in the `.swiftmodules` directly.

Followup changes to SwiftDriver will enable explicit PCH compilation of such dependenceis, but for the time being restore prior behavior for non-CAS explicit module builds.

Resolves rdar://116006619
This commit is contained in:
Artem Chikin
2023-10-10 15:53:47 -07:00
parent 3bb5424296
commit 75ee48ca77
5 changed files with 31 additions and 12 deletions

View File

@@ -477,12 +477,19 @@ SerializedModuleLoaderBase::scanModuleFile(Twine modulePath, bool isFramework) {
auto importedHeaderSet = binaryModuleImports.get().headerImports;
std::vector<std::string> importedHeaders;
importedHeaders.reserve(importedHeaderSet.size());
llvm::transform(importedHeaderSet.keys(),
std::back_inserter(importedHeaders),
[](llvm::StringRef N) {
return N.str();
});
// FIXME: We only record these dependencies in CAS mode, because
// we require explicit PCH tasks to be produced for imported header
// of binary module dependencies. In the meantime, in non-CAS mode
// loading clients will consume the `.h` files encoded in the `.swiftmodules`
// directly.
if (Ctx.ClangImporterOpts.CASOpts) {
importedHeaders.reserve(importedHeaderSet.size());
llvm::transform(importedHeaderSet.keys(),
std::back_inserter(importedHeaders),
[](llvm::StringRef N) {
return N.str();
});
}
auto &importedOptionalModuleSet = binaryModuleOptionalImports.get().moduleImports;
std::vector<std::string> importedOptionalModuleNames;