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

Daniel Marjamäki via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 9 06:44:44 PST 2015


danielmarjamaki marked 12 inline comments as done.

================
Comment at: clang-tidy/readability/NonConstParameterCheck.cpp:44
@@ +43,3 @@
+      if (B->isAssignmentOp())
+        markCanNotBeConst(B, false);
+    } else if (const auto *CE = dyn_cast<CallExpr>(S)) {
----------------
I tried to unify like that. It almost worked. I failed to put the stmt(...) and varDecl(...) in the same matcher.

================
Comment at: clang-tidy/readability/NonConstParameterCheck.cpp:49
@@ +48,3 @@
+      for (const auto *Arg : CE->arguments()) {
+        markCanNotBeConst(Arg->IgnoreParenCasts(), true);
+      }
----------------
good question!

I tested and the checker seemed to handle these. apparently the ast-matcher scanned the functions recursively. However I don't know if we know that it will work, so I changed the checker.

================
Comment at: clang-tidy/readability/NonConstParameterCheck.cpp:84
@@ +83,3 @@
+}
+
+void NonConstParameterCheck::onEndOfTranslationUnit() {
----------------
I believe I fixed all these.


http://reviews.llvm.org/D15332





More information about the cfe-commits mailing list