[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
Fri Apr 26 13:47:52 PDT 2019
erik.pilkington added a comment.
In D61147#1479956 <https://reviews.llvm.org/D61147#1479956>, @rjmccall wrote:
> In D61147#1479940 <https://reviews.llvm.org/D61147#1479940>, @erik.pilkington wrote:
> > In D61147#1479932 <https://reviews.llvm.org/D61147#1479932>, @rjmccall wrote:
> > > I do not think the ObjC version of this diagnostic is useful as it's been explained here, and I would strongly recommend just not including such a warning for the time being.
> > Why? It seems to me like the vast majority of methods only declared in an `@implementation` are used as local helpers (even if people probably should be using functions for this), where this warning would be useful. Maybe I'm missing something? Still trying to learn more about Objective-C.
> What rule are you suggesting for whether a method is "only declared in an `@implementation`"? Where exactly are you proposing to look for other declarations?
> Objective-C does not have a formalized notion of an `@implementation`-private method, or really even an unambiguous convention for them (underscoring is *library*-private by convention, not class-private). The Objective-C ecosystem includes a lot of informal protocols and conventions based around discovery via naming, and Objective-C programmers do (admittedly rarely) just override methods that they know are there but which they can't see. These things make me very worried about trying to port assumptions from other languages.
Concretely, I was just thinking of using something like `ObjCMethodDecl::isOverriding`, but if that isn't a good enough heuristic for finding local methods then I guess we should just forgo methods entirely.
CHANGES SINCE LAST ACTION
More information about the cfe-commits