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

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 25 13:42:44 PDT 2019


ahatanak created this revision.
ahatanak added reviewers: erik.pilkington, rjmccall.
ahatanak added a project: clang.
Herald added subscribers: dexonsmith, jkorous.

The new warning `-Wunused-parameter-non-objc-method` works exactly the same as `-Wunused-parameter ` except for unused parameters of ObjC methods. This can be handy when users want to use `-Wunused-parameter ` but don't want to annotate each unused ObjC method parameters with `__attribute__((unused))` or insert `(void)unused_param` into the body of the method to silence the warning since, unlike C/C++ functions, it's not possible to comment out the unused parameters of ObjC methods.

  // Can't do this for ObjC methods.
  int foo(int /*param*) {}

rdar://problem/41561853


Repository:
  rC Clang

https://reviews.llvm.org/D61147

Files:
  include/clang/Basic/DiagnosticGroups.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/Sema.h
  lib/Sema/SemaDecl.cpp
  test/Sema/warn-unused-parameters.c
  test/SemaObjC/method-unused-attribute.m

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61147.196718.patch
Type: text/x-patch
Size: 5447 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190425/0be1c7f4/attachment.bin>


More information about the cfe-commits mailing list