[all-commits] [llvm/llvm-project] 039f79: [SEMA] Added warn_decl_shadow support for structur...

David Crook via All-commits all-commits at lists.llvm.org
Tue Feb 23 13:37:31 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 039f79c78cfa2c0d0d61de117ff46aa43cb5e831
      https://github.com/llvm/llvm-project/commit/039f79c78cfa2c0d0d61de117ff46aa43cb5e831
  Author: David Crook <DGCrook at gmail.com>
  Date:   2021-02-23 (Tue, 23 Feb 2021)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/include/clang/Sema/Sema.h
    M clang/lib/Sema/SemaDecl.cpp
    M clang/lib/Sema/SemaDeclCXX.cpp
    M clang/test/SemaCXX/warn-shadow.cpp

  Log Message:
  -----------
  [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




More information about the All-commits mailing list