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

David Crook via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 5 08:45:13 PST 2021


Vexthil created this revision.
Vexthil added a reviewer: rsmith.
Vexthil added a project: clang.
Vexthil requested review of this revision.
Herald added a subscriber: cfe-commits.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96147

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/test/SemaCXX/warn-shadow.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96147.321768.patch
Type: text/x-patch
Size: 5761 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210205/022ee624/attachment.bin>


More information about the cfe-commits mailing list