Merge pull request #70335 from artemcm/DepScanSkipSwiftDependencyClangSearchPaths

[Explicit Moduele Builds] Look through forwarding modules for `canImport` version check.
This commit is contained in:
Artem Chikin
2023-12-08 18:40:13 -08:00
committed by GitHub
2 changed files with 54 additions and 0 deletions

View File

@@ -2244,6 +2244,21 @@ bool ExplicitSwiftModuleLoader::canImportModule(
it->second.modulePath);
return false;
}
// If it's a forwarding module, load the YAML file from disk and get the path
// to the actual module for the version check.
if (!serialization::isSerializedAST((*moduleBuf)->getBuffer())) {
if (auto forwardingModule = ForwardingModule::load(**moduleBuf)) {
moduleBuf = fs.getBufferForFile(forwardingModule->underlyingModulePath);
if (!moduleBuf) {
Ctx.Diags.diagnose(SourceLoc(),
diag::error_opening_explicit_module_file,
forwardingModule->underlyingModulePath);
return false;
}
}
}
auto metaData = serialization::validateSerializedAST(
(*moduleBuf)->getBuffer(), Ctx.SILOpts.EnableOSSAModules,
Ctx.LangOpts.SDKName);