[PATCH] D18408: readability check for const params in declarations
Alexander Kornienko via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 29 09:42:19 PDT 2016
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.
Looks good with one nit. Thank you for the new check!
Do you need me to submit the patch for you?
================
Comment at: clang-tidy/readability/AvoidConstParamsInDecls.cpp:24
@@ +23,3 @@
+ if (Param.getIdentifier() != nullptr)
+ return {Param.getLocStart(), Param.getLocEnd().getLocWithOffset(-1)};
+ return Param.getSourceRange();
----------------
I suspect this will fail to build in MSVC 2013, since it doesn't support uniform initialization. But it might be just initializer lists that it doesn't support. We can try.
================
Comment at: clang-tidy/readability/AvoidConstParamsInDecls.cpp:32
@@ +31,3 @@
+void AvoidConstParamsInDecls::registerMatchers(MatchFinder *Finder) {
+ const auto const_param_decl =
+ parmVarDecl(hasType(qualType(isConstQualified()))).bind("param");
----------------
"Variable names should be nouns (as they represent state). The name should be camel case, and start with an upper case letter (e.g. Leader or Boats)."
http://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly
http://reviews.llvm.org/D18408
More information about the cfe-commits
mailing list