[clang] [clang][Sema] Always clear UndefinedButUsed (PR #73955)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 30 08:02:31 PST 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Jonas Hahnfeld (hahnjo)
<details>
<summary>Changes</summary>
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`.
---
Full diff: https://github.com/llvm/llvm-project/pull/73955.diff
1 Files Affected:
- (modified) clang/lib/Sema/Sema.cpp (+1-2)
``````````diff
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() {
``````````
</details>
https://github.com/llvm/llvm-project/pull/73955
More information about the cfe-commits
mailing list