[PATCH] [clang-tidy] Add a checker that flags unnamed parameters.
Benjamin Kramer
benny.kra at gmail.com
Tue Jul 15 09:02:32 PDT 2014
================
Comment at: test/clang-tidy/google-readability-function.cpp:69
@@ +68,3 @@
+struct Derived : public Base {
+ void foo(int);
+// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: all parameters should be named in a function
----------------
Alexander Kornienko wrote:
> What does the check do in this case?
>
> struct Base1 { virtual void f(int i) {} };
> struct Base2 { virtual void f(bool b) {} };
> template <typename T, typename Y>
> struct Derived : public T {
> void f(Y) {}
> };
> int main() {
> Derived<Base1, int>();
> Derived<Base2, bool>();
> }
>
I think it works because we see the template definition first. But I'll add the bulky template instance matcher, safe is better.
```
5:13: warning: all parameters should be named in a function [google-readability-function]
void f(Y) {}
^
/*unused*/
```
http://reviews.llvm.org/D4518
More information about the cfe-commits
mailing list