https://github.com/hahnjo created https://github.com/llvm/llvm-project/pull/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`. >From 9dd0362e1dcffa5475d9f959ce9bfc6a7e83083b Mon Sep 17 00:00:00 2001 From: Jonas Hahnfeld <jonas.hahnf...@cern.ch> Date: Thu, 30 Nov 2023 16:51:23 +0100 Subject: [PATCH] [clang][Sema] Always clear UndefinedButUsed 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. --- clang/lib/Sema/Sema.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index 9771aaa2f3b0371..d08f8cd56b39bde 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