[PATCH] D12359: New warning -Wnonconst-parameter when a pointer parameter can be const

Daniel Marjamäki via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 18 07:41:05 PST 2015


danielmarjamaki marked an inline comment as done.
danielmarjamaki added a comment.

Does anybody else think that this should be moved to clang-tidy?

I believe that the noise level is very low when I scan various open source projects. My script tries to run clang on all projects in the debian archive. I have shown triaged results before, but if you are not convinced I can upload the complete results so you can look at that. For comparison, I get more noise from existing compiler warnings.


================
Comment at: include/clang/AST/Decl.h:791
@@ +790,3 @@
+
+    /// \brief Whether this variable has non-const use so it can't be const.
+    unsigned NonConstUse:1;
----------------
hmm.. I'll change "variable" to "parameter" in the next diff.

================
Comment at: include/clang/AST/Decl.h:857
@@ -853,3 +856,3 @@
 public:
   typedef redeclarable_base::redecl_range redecl_range;
   typedef redeclarable_base::redecl_iterator redecl_iterator;
----------------
Thanks! I have moved NonConstUse to ParmVarDeclBits.


http://reviews.llvm.org/D12359





More information about the cfe-commits mailing list