[PATCH] D61147: [Sema][ObjC] Add a flavor of -Wunused-parameter that doesn't diagnose unused parameters of ObjC methods

Erik Pilkington via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 25 15:38:13 PDT 2019

erik.pilkington added a comment.

In D61147#1479530 <https://reviews.llvm.org/D61147#1479530>, @ahatanak wrote:

> In D61147#1479468 <https://reviews.llvm.org/D61147#1479468>, @erik.pilkington wrote:
> > > Yeah, I tend to think we should just suppress this unconditionally in Objective-C.
> >
> > IMO this warning still makes sense for normal functions, or methods that are only declared in an @implementation. Adding a fix-it to cast to void in the function/method body would probably go a long way too.
> Should we use the new warning to warn just about unused ObjC method parameters and have `-Wunused-parameter` warn about everything else? If we make `-Wunused-parameter` unconditionally ignore ObjC methods, a user might complain about it later if `-Wunused-parameter` didn't diagnose an unused parameter when it should have.

Yeah, that seems fine to me, leave the method diagnostic off-by-default, since I doubt many would actually want it. Do you think its worth emitting -Wunused-parameter in pure-`@implementation` methods?

  rC Clang



More information about the cfe-commits mailing list