[PATCH] D11346: Extend misc-unused-parameters to delete parameters of static functions

Chandler Carruth chandlerc at gmail.com
Sun Jul 19 20:14:49 PDT 2015


chandlerc accepted this revision.
chandlerc added a comment.
This revision is now accepted and ready to land.

Feel free to address the comments below in a follow-up patch. This seems a fine next step, LGTM


================
Comment at: clang-tidy/misc/UnusedParametersCheck.cpp:76
@@ +75,3 @@
+
+  // Handle local functions by deleting the parameters.
+  unsigned ParamIndex = Param->getFunctionScopeIndex();
----------------
Hmm, I thought of a reason to not delete parameters from local functions -- if they're used in some way other than calling them such as using them as an argument to a template.

Maybe check for non-CallExpr DeclRefExprs of the function, and fall back to the commenting strategy?

================
Comment at: test/clang-tidy/misc-unused-parameters.cpp:23-24
@@ +22,4 @@
+
+// Remove parameters of local functions
+// ====================================
+static void staticFunctionA(int i);
----------------
Does this already handle function in anonymous namespaces? Want to add those as a follow-up? The next obvious chunk is to handle non-virtual methods of classes in anonymous namespaces. Perhaps those will be handled automatically though.


http://reviews.llvm.org/D11346







More information about the cfe-commits mailing list