[PATCH] [clang-tidy] Add a checker that flags unnamed parameters.

Benjamin Kramer benny.kra at gmail.com
Tue Jul 15 06:52:18 PDT 2014


================
Comment at: clang-tidy/google/NamedParameterCheck.cpp:50
@@ +49,3 @@
+    const char *Begin = SM.getCharacterData(Parm->getLocStart());
+    const char *End = SM.getCharacterData(Parm->getLocation());
+    StringRef Data(Begin, End - Begin);
----------------
Alexander Kornienko wrote:
> I'm curious where does Parm->getLocation() point in case where there is a parameter name (to the identifier?) and where there is not?
It always points to the name or the place where the name *would* be. This behavior is a bit strange sometimes but makes things like getting the name in function pointers right very easy,

================
Comment at: test/clang-tidy/google-readability-function.cpp:1
@@ +1,2 @@
+// RUN: $(dirname %s)/check_clang_tidy_fix.sh %s google-readability-function %t
+// REQUIRES: shell
----------------
Alexander Kornienko wrote:
> Please add tests with multiple instantiations of the same template. I suspect, currently the check will suggest multiple replacements.
I checked that and it doesn't (do warnings get deduplicated somewhere)? I'll add another test.

http://reviews.llvm.org/D4518






More information about the cfe-commits mailing list