aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorIvan Murashko <ivan.murashko@gmail.com>2025-09-15 10:55:59 +0100
committerGitHub <noreply@github.com>2025-09-15 10:55:59 +0100
commitd8c2607fb1f4094db18e7716764738f9bc8489df (patch)
tree936646201bbc693a93175303486cf4643c334b5f /clang/lib/Frontend/CompilerInvocation.cpp
parent44061d14fb03ebbd38050c628ed009ae4db2714c (diff)
downloadllvm-d8c2607fb1f4094db18e7716764738f9bc8489df.zip
llvm-d8c2607fb1f4094db18e7716764738f9bc8489df.tar.gz
llvm-d8c2607fb1f4094db18e7716764738f9bc8489df.tar.bz2
[clang][Sema] Fix false positive -Wshadow with structured binding captures (#157667)
Previously, lambda init captures of structured bindings were incorrectly classified as regular shadow warnings (shown with `-Wshadow`), while regular parameter captures were correctly classified as `uncaptured-local` warnings (shown only with `-Wshadow-all`). This created inconsistent behavior: ```cpp void foo1(std::pair<int, int> val) { [val = std::move(val)](){}(); // No warning with -Wshadow (correct) } void foo2(std::pair<int, int> val) { auto [a, b] = val; [a = std::move(a)](){}(); // Warning with -Wshadow (incorrect) } ``` The fix extends the existing lambda capture classification logic in `CheckShadow()` to handle `BindingDecl` consistently with `VarDecl`, ensuring both cases show no warnings with `-Wshadow` and `uncaptured-local` warnings with `-Wshadow-all`. Fixes #68605. --------- Co-authored-by: Mariya Podchishchaeva <mariya.podchishchaeva@intel.com>
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions