Skip to content

Commit 7492b74

Browse files
committed
[LookupVisibleDecls] Don't visit auxiliary declarations twice
getAllMembers() includes the auxiliary decls. (cherry picked from commit 6f5283e)
1 parent d69010e commit 7492b74

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

lib/Sema/LookupVisibleDecls.cpp

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -217,24 +217,17 @@ static void collectVisibleMemberDecls(const DeclContext *CurrDC, LookupState LS,
217217
Type BaseType,
218218
IterableDeclContext *Parent,
219219
SmallVectorImpl<ValueDecl *> &FoundDecls) {
220-
auto check = [&](Decl *decl) {
221-
auto *VD = dyn_cast<ValueDecl>(decl);
220+
for (auto Member : Parent->getAllMembers()) {
221+
auto *VD = dyn_cast<ValueDecl>(Member);
222222
if (!VD)
223-
return;
223+
continue;
224224
if (!isDeclVisibleInLookupMode(VD, LS, CurrDC))
225-
return;
225+
continue;
226226
if (!evaluateOrDefault(CurrDC->getASTContext().evaluator,
227227
IsDeclApplicableRequest(DeclApplicabilityOwner(CurrDC, BaseType, VD)),
228228
false))
229-
return;
229+
continue;
230230
FoundDecls.push_back(VD);
231-
};
232-
233-
for (auto Member : Parent->getAllMembers()) {
234-
check(Member);
235-
Member->visitAuxiliaryDecls([&](Decl *d) {
236-
check(d);
237-
});
238231
}
239232
}
240233

0 commit comments

Comments
 (0)