Author: Jonas Hahnfeld Date: 2023-12-12T17:57:19+01:00 New Revision: ac616408b276fc953d5f800229830b48fef4d308
URL: https://github.com/llvm/llvm-project/commit/ac616408b276fc953d5f800229830b48fef4d308 DIFF: https://github.com/llvm/llvm-project/commit/ac616408b276fc953d5f800229830b48fef4d308.diff LOG: [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`. Added: Modified: clang/lib/Sema/Sema.cpp Removed: ################################################################################ diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index 22929aa6316d7f..cafbecebc8a119 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -870,6 +870,7 @@ static void checkUndefinedButUsed(Sema &S) { // Collect all the still-undefined entities with internal linkage. SmallVector<std::pair<NamedDecl *, SourceLocation>, 16> Undefined; S.getUndefinedButUsed(Undefined); + S.UndefinedButUsed.clear(); if (Undefined.empty()) return; for (const auto &Undef : Undefined) { @@ -923,8 +924,6 @@ static void checkUndefinedButUsed(Sema &S) { if (UseLoc.isValid()) S.Diag(UseLoc, diag::note_used_here); } - - S.UndefinedButUsed.clear(); } void Sema::LoadExternalWeakUndeclaredIdentifiers() { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits