Skip to content

Commit 094ee2f

Browse files
committed
[NamedLazyMemberLoading] Tolerate mid-flight getMembers() calls better.
1 parent a967f8c commit 094ee2f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/AST/NameLookup.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,10 +1355,11 @@ TinyPtrVector<ValueDecl *> NominalTypeDecl::lookupDirect(
13551355
// will flip the hasLazyMembers() flag to false as well.
13561356
if (!useNamedLazyMemberLoading) {
13571357
// If we're about to load members here, purge the MemberLookupTable;
1358-
// it will be rebuilt in prepareLookup, below.
1359-
if (hasLazyMembers() && LookupTable.getPointer()) {
1360-
// We should not have scanned the IDC list yet. Double check.
1361-
assert(!LookupTable.getInt());
1358+
// it will be rebuilt in prepareLookup, below. Base this decision on
1359+
// the LookupTable's int value, not hasLazyMembers(), since the latter
1360+
// can sometimes change underfoot if some other party calls getMembers
1361+
// outside of lookup (eg. typo correction).
1362+
if (LookupTable.getPointer() && !LookupTable.getInt()) {
13621363
LookupTable.getPointer()->clear();
13631364
}
13641365

0 commit comments

Comments
 (0)