[Serialization] Ignore OS versions when loading resilient modules (#19401)

Swift currently checks if an imported module has a deployment target
compatible with what’s currently being compiled. For a resilient
module, though, you really want to know the /oldest/ deployment target
the library supports, not the one it was most recently compiled with,
and we don’t currently save that information. Disable this check for
now when the module is resilient.

(Why not do this on the serialization side? Because the deployment
target you compile with is still relevant when trying to match the
compilation environment as closely as possible, which LLDB tries to
do. It's also just useful information for debugging the compiler.)

rdar://problem/42903218
This commit is contained in:
Jordan Rose
2018-09-21 08:59:05 -07:00
committed by GitHub
parent 051e73883f
commit cad4c71ab7
5 changed files with 21 additions and 5 deletions

View File

@@ -1360,7 +1360,8 @@ Status ModuleFile::associateWithFileContext(FileUnit *file,
assert(!FileContext && "already associated with an AST module");
FileContext = file;
if (file->getParentModule()->getName().str() != Name)
ModuleDecl *M = file->getParentModule();
if (M->getName().str() != Name)
return error(Status::NameMismatch);
ASTContext &ctx = getContext();
@@ -1371,6 +1372,7 @@ Status ModuleFile::associateWithFileContext(FileUnit *file,
return error(Status::TargetIncompatible);
}
if (ctx.LangOpts.EnableTargetOSChecking &&
M->getResilienceStrategy() != ResilienceStrategy::Resilient &&
isTargetTooNew(moduleTarget, ctx.LangOpts.Target)) {
return error(Status::TargetTooNew);
}