Author: Justin Stitt
Date: 2026-01-27T09:17:28-08:00
New Revision: 828f14483dc3f194c3e8de730f5fa8ea6348864f

URL: 
https://github.com/llvm/llvm-project/commit/828f14483dc3f194c3e8de730f5fa8ea6348864f
DIFF: 
https://github.com/llvm/llvm-project/commit/828f14483dc3f194c3e8de730f5fa8ea6348864f.diff

LOG: [Clang] Invert emptiness check for correctness (#178068)

Fix a bug 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.

Added: 
    

Modified: 
    clang/lib/Sema/SemaDecl.cpp

Removed: 
    


################################################################################
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;
   });
 


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to