From 4db76dd4ae4f5f721b8afc96120ec855ba6cb91b Mon Sep 17 00:00:00 2001 From: Justin Stitt Date: Mon, 26 Jan 2026 13:55:55 -0800 Subject: [PATCH] fix empty() check zwuis on github pointed out a bug [1] in a deferred call which was supposed to clear the DeclForInitializer field but was doing so incorrectly because the emptiness check needs to be inverted. [1]: https://github.com/llvm/llvm-project/pull/163885/changes/BASE..082c9769209e80504a2205581a4387bcf39ca5df#r2726301659 Signed-off-by: Justin Stitt --- clang/lib/Sema/SemaDecl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 0b3416a12f9f4..907b7b367f19b 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -13825,7 +13825,7 @@ void Sema::DiagnoseUniqueObjectDuplication(const VarDecl *VD) { void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) { llvm::scope_exit ResetDeclForInitializer([this]() { - if (this->ExprEvalContexts.empty()) + if (!this->ExprEvalContexts.empty()) this->ExprEvalContexts.back().DeclForInitializer = nullptr; });