================
@@ -8496,6 +8498,21 @@ void Sema::CheckShadow(NamedDecl *D, NamedDecl 
*ShadowedDecl,
                 ->ShadowingDecls.push_back({D, VD});
             return;
           }
+        } else if (isa<BindingDecl>(ShadowedDecl)) {
+          // Apply lambda capture logic only when D is actually a lambda 
capture
+          if (isa<VarDecl>(D) && cast<VarDecl>(D)->isInitCapture()) {
+            if (RD->getLambdaCaptureDefault() == LCD_None) {
+              // BindingDecls cannot be explicitly captured, so always treat as
+              // uncaptured
+              WarningDiag = diag::warn_decl_shadow_uncaptured_local;
+            } else {
+              // Same deferred handling as VarDecl
+              cast<LambdaScopeInfo>(getCurFunction())
+                  ->ShadowingDecls.push_back({D, ShadowedDecl});
+              return;
+            }
+          }
+          // For non-init-capture cases, fall through to regular shadow logic
----------------
ivanmurashko wrote:

Consolidated `VarDecl` and `BindingDecl` handling using `ValueDecl` at 
27fc9b7095e6ab993782e121e1ff1a3776b2ab0a

https://github.com/llvm/llvm-project/pull/157667
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to