Skip to content

Commit ac61640

Browse files
authored
[clang][Sema] Always clear UndefinedButUsed (#73955)
Before, it was only cleared if there were undefined entities. This is important for Clang's incremental parsing as used by `clang-repl` that might receive multiple calls to `Sema.ActOnEndOfTranslationUnit`.
1 parent 4b4dcb4 commit ac61640

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

clang/lib/Sema/Sema.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,7 @@ static void checkUndefinedButUsed(Sema &S) {
870870
// Collect all the still-undefined entities with internal linkage.
871871
SmallVector<std::pair<NamedDecl *, SourceLocation>, 16> Undefined;
872872
S.getUndefinedButUsed(Undefined);
873+
S.UndefinedButUsed.clear();
873874
if (Undefined.empty()) return;
874875

875876
for (const auto &Undef : Undefined) {
@@ -923,8 +924,6 @@ static void checkUndefinedButUsed(Sema &S) {
923924
if (UseLoc.isValid())
924925
S.Diag(UseLoc, diag::note_used_here);
925926
}
926-
927-
S.UndefinedButUsed.clear();
928927
}
929928

930929
void Sema::LoadExternalWeakUndeclaredIdentifiers() {

0 commit comments

Comments
 (0)