]> granicus.if.org Git - clang/commit
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)
commite5d643a3e7fb52ce6a87c84dac0de41bda6a63e7
tree8eec2555b70bd0c038c182d1c0bd95deafc7a81c
parent4eaa6552bba77670e89d3bf6fab1e30f669141b6
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@267957 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/Diagnostic.h
include/clang/Basic/DiagnosticGroups.td
include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Sema/Sema.h
lib/Sema/AnalysisBasedWarnings.cpp
lib/Sema/SemaDecl.cpp
lib/Sema/SemaExpr.cpp
test/SemaCXX/warn-shadow.cpp