sema: diagnose importation from disallowed modules

This commit is contained in:
Xi Ge
2022-11-25 22:22:50 -08:00
parent 67bbab7e02
commit c3db946517
5 changed files with 54 additions and 0 deletions

View File

@@ -1923,6 +1923,18 @@ Identifier ModuleDecl::getRealName() const {
return getASTContext().getRealModuleName(getName());
}
bool ModuleDecl::allowImportedBy(ModuleDecl *importer) const {
if (allowableClientNames.empty())
return true;
for (auto id: allowableClientNames) {
if (importer->getRealName() == id)
return true;
if (importer->getABIName() == id)
return true;
}
return false;
}
Identifier ModuleDecl::getABIName() const {
if (!ModuleABIName.empty())
return ModuleABIName;