[PATCH] D96147: [SEMA] Added warn_decl_shadow support for structured bindings

Shoaib Meenai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 15 16:20:01 PDT 2022


smeenai added a comment.
Herald added a project: All.

This is very belated, sorry :)

Our shadowing warnings have special behavior for lambdas and local variables: the warning for lambdas shadowing uncaptured local variables falls under `-Wshadow-uncaptured-local`, which isn't turned on for `-Wshadow` (only for `-Wshadow-all`). However, this doesn't extend to structured bindings. Compare https://godbolt.org/z/nP6b9f8o4, which doesn't fire for `-Wshadow`, to https://godbolt.org/z/9he8Ezsbb, which is the equivalent with structured bindings and does fire for `-Wshadow`. This is triggering a whole bunch of new `-Wshadow` warnings in our codebase, and I'm wondering if we'd consider also separating the lambda + structured binding case into its own warning group, to match the behavior for lambdas + local variables.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96147/new/

https://reviews.llvm.org/D96147



More information about the cfe-commits mailing list