Verify that _Concurrency *can* be imported on implicit import.

In case the compiler is used with concurrency features enabled (by-default or otherwise), and an older SDK is used which does not include the `_Concurrency` module, do not load this module implicitly. Instead, emit a diagnostic indicating that no such module is found.

rdar://76967260
This commit is contained in:
Artem Chikin
2021-04-21 18:56:09 -07:00
parent 16adf76b68
commit f92abb8c81
6 changed files with 74 additions and 3 deletions

View File

@@ -1950,7 +1950,7 @@ bool ASTContext::shouldPerformTypoCorrection() {
return NumTypoCorrections <= LangOpts.TypoCorrectionLimit;
}
bool ASTContext::canImportModule(ImportPath::Element ModuleName) {
bool ASTContext::canImportModuleImpl(ImportPath::Element ModuleName) const {
// If this module has already been successfully imported, it is importable.
if (getLoadedModule(ImportPath::Module::Builder(ModuleName).get()) != nullptr)
return true;
@@ -1966,10 +1966,22 @@ bool ASTContext::canImportModule(ImportPath::Element ModuleName) {
}
}
FailedModuleImportNames.insert(ModuleName.Item);
return false;
}
bool ASTContext::canImportModule(ImportPath::Element ModuleName) {
if (canImportModuleImpl(ModuleName)) {
return true;
} else {
FailedModuleImportNames.insert(ModuleName.Item);
return false;
}
}
bool ASTContext::canImportModule(ImportPath::Element ModuleName) const {
return canImportModuleImpl(ModuleName);
}
ModuleDecl *
ASTContext::getModule(ImportPath::Module ModulePath) {
assert(!ModulePath.empty());