[PATCH] D18271: Avoid -Wshadow warnings about constructor parameters named after fields

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 23 11:07:03 PDT 2016


On Wed, Mar 23, 2016 at 11:03 AM, Alexander Kornienko via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> alexfh added a subscriber: alexfh.
> alexfh added a comment.
>
> As a data point: I ran -Wshadow on our code base with a similar, but
> simpler patch (http://reviews.llvm.org/D18395, just disables the warning
> on ctor parameters named after fields). It removes more than half of the
> hits (from ~100k initially) and a random sample of ~100 removed removed
> hits didn't contain any issues that we'd like to still be warning about.
>
> Ultimately, I think, this diagnostic should be made much less noisy to be
> actually useful. So maybe even starting with a removal of a larger subset
> of warnings (and then gradually adding back the cases that seem to be
> important to flag) would be better.
>

Right - my concern is that for people who are already using the warning,
that might be a loss of functionality for them (if they've gone to the
hassle/code convention of not naming members the same as ctor parameters,
etc) & so they'll start missing mistakes they thought they were guarded
against.


>
>
> ================
> Comment at: lib/Sema/SemaExpr.cpp:9887
> @@ -9854,1 +9886,3 @@
>      if (ConvTy == Compatible) {
> +      const Expr *InnerLHS = LHSExpr->IgnoreParenCasts();
> +      const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(InnerLHS);
> ----------------
> Why this change?
>
>
> http://reviews.llvm.org/D18271
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160323/ca7af6e8/attachment.html>


More information about the cfe-commits mailing list