[PATCH] D15332: new clang-tidy checker readability-non-const-parameter

Daniel Marjamäki via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 15 02:47:53 PDT 2016


danielmarjamaki marked 12 inline comments as done.

================
Comment at: docs/clang-tidy/checks/readability-non-const-parameter.rst:6
@@ +5,3 @@
+
+Finds function parameters that should be const. When const is used properly,
+many mistakes can be avoided. Advantages when using const properly:
----------------
hokein wrote:
> Looks like what the document says isn't consistent with the check, since the check only finds non-const pointer parameter. 
I changed "Finds function parameters.." to "Finds function pointer parameters..".

================
Comment at: test/clang-tidy/readability-non-const-parameter.cpp:3
@@ +2,3 @@
+
+// Currently the checker only warns about pointer arguments.
+//
----------------
hokein wrote:
> It makes sense to move this document to the `rst`, I think.
Done. First line in rst will now say: "Finds function pointer parameters that should be const".

================
Comment at: test/clang-tidy/readability-non-const-parameter.cpp:219
@@ +218,3 @@
+public:
+  C(int *p) : p(p) {}
+private:
----------------
hokein wrote:
> Please add a test case:
> 
> ```
> class C {
> public:
>   C(int *p) : p(p) {}
> private:
>   const int *p;
> };
> ```
> 
> BTW, does the check support class method?
Thanks, I added such class.

I also added one class that shows that class methods are supported.



http://reviews.llvm.org/D15332





More information about the cfe-commits mailing list