[Index] Use access level to check decls to include

`isAccessibleFrom` has special handling for `@_objcImplementation`
members, which causes the definition in Swift to be missed. Use access
level directly rather than passing `nullptr` into `isAccessibleFrom`.
This commit is contained in:
Ben Barham
2023-01-30 19:06:03 -08:00
parent 4480d89536
commit 1808a398f1
3 changed files with 27 additions and 3 deletions

View File

@@ -3467,14 +3467,14 @@ bool FileUnit::walk(ASTWalker &walker) {
if (SkipInternal) {
// Ignore if the decl isn't visible
if (auto *VD = dyn_cast<ValueDecl>(D)) {
if (!VD->isAccessibleFrom(nullptr))
if (VD->getFormalAccess() < AccessLevel::Public)
continue;
}
// Also ignore if the extended nominal isn't visible
if (auto *ED = dyn_cast<ExtensionDecl>(D)) {
auto *ND = ED->getExtendedNominal();
if (ND && !ND->isAccessibleFrom(nullptr))
if (ND && ND->getFormalAccess() < AccessLevel::Public)
continue;
}
}