mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Explicit Moduele Builds] Look through forwarding modules for 'canImport' version check.
Otherwise we default to version 0 for all modules which get forwarded. Resolves rdar://119346213
This commit is contained in:
@@ -2246,6 +2246,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, !Ctx.LangOpts.DebuggerSupport);
|
||||
|
||||
Reference in New Issue
Block a user