Let module lookups ignore access control

…at least for declarations in the current module. We continue to pretend that inaccessible declarations in other modules do not exist.
This commit is contained in:
Becca Royal-Gordon
2023-11-02 13:54:49 -07:00
parent 8651af4325
commit db19c19e19
4 changed files with 9 additions and 3 deletions

View File

@@ -165,6 +165,11 @@ void ModuleNameLookup<LookupStrategy>::lookupInModule(
if (resolutionKind == ResolutionKind::MacrosOnly && !isa<MacroDecl>(VD))
return true;
if (respectAccessControl &&
// NL_IgnoreAccessControl applies only to the current module.
!((options & NL_IgnoreAccessControl) &&
moduleScopeContext &&
moduleScopeContext->getParentModule() ==
VD->getDeclContext()->getParentModule()) &&
!VD->isAccessibleFrom(moduleScopeContext, false,
includeUsableFromInline))
return true;