Avoid -Wshadow warnings about constructor parameters named after fields
authorReid Kleckner <rnk@google.com>
Fri, 29 Apr 2016 00:37:43 +0000 (00:37 +0000)
committerReid Kleckner <rnk@google.com>
Fri, 29 Apr 2016 00:37:43 +0000 (00:37 +0000)
commitf463a8a424e7e1c141aa7d9b96f1898183d2b680
tree60e74fb87802d817cfeb1df221cc7207360387d3
parentb87faffdb9bc86c4c08224bdbaa37096edcfda4d
Avoid -Wshadow warnings about constructor parameters named after fields

Usually these parameters are used solely to initialize the field in the
initializer list, and there is no real shadowing confusion.

There is a new warning under -Wshadow called
-Wshadow-field-in-constructor-modified. It attempts to find
modifications of such constructor parameters that probably intended to
modify the field.

It has some false negatives, though, so there is another warning group,
-Wshadow-field-in-constructor, which always warns on this special case.
For users who just want the old behavior and don't care about these fine
grained groups, we have a new warning group called -Wshadow-all that
activates everything.

Fixes PR16088.

Reviewers: rsmith

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D18271

llvm-svn: 267957
clang/include/clang/Basic/Diagnostic.h
clang/include/clang/Basic/DiagnosticGroups.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Sema/Sema.h
clang/lib/Sema/AnalysisBasedWarnings.cpp
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaExpr.cpp
clang/test/SemaCXX/warn-shadow.cpp