[SEMA] Added warn_decl_shadow support for structured bindings
authorDavid Crook <DGCrook@gmail.com>
Tue, 23 Feb 2021 20:48:15 +0000 (12:48 -0800)
committerRichard Smith <richard@metafoo.co.uk>
Tue, 23 Feb 2021 21:37:05 +0000 (13:37 -0800)
commit039f79c78cfa2c0d0d61de117ff46aa43cb5e831
tree1e3a78362071e482c9c5c61132cd7e19986f5c2d
parent7f9d5d6e444c91ce6f2e377b312ac573dfc6779a
[SEMA] Added warn_decl_shadow support for structured bindings

https://bugs.llvm.org/show_bug.cgi?id=40858

CheckShadow is now called for each binding in the structured binding to make sure it does not shadow any other variable in scope. This does use a custom implementation of getShadowedDeclaration though because a BindingDecl is not a VarDecl

Added a few unit tests for this. In theory though all the other shadow unit tests should be duplicated for the structured binding variables too but whether it is probably not worth it as they use common code. The MyTuple and std interface code has been copied from live-bindings-test.cpp

Reviewed By: rsmith

Differential Revision: https://reviews.llvm.org/D96147
clang/docs/ReleaseNotes.rst
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Sema/Sema.h
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaDeclCXX.cpp
clang/test/SemaCXX/warn-shadow.cpp