[PATCH] D54943: [clang-tidy] implement new check 'misc-const-correctness' to add 'const' to unmodified variables

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 8 00:43:53 PDT 2022


njames93 accepted this revision.
njames93 added a comment.
This revision is now accepted and ready to land.

LGTM, just a couple points but not essential.



================
Comment at: clang-tools-extra/clang-tidy/misc/ConstCorrectnessCheck.cpp:184-187
+  if (ScopesCache.find(LocalScope) == ScopesCache.end())
+    ScopesCache.insert(std::make_pair(
+        LocalScope,
+        std::make_unique<ExprMutationAnalyzer>(*LocalScope, *Context)));
----------------



================
Comment at: clang-tools-extra/clang-tidy/misc/ConstCorrectnessCheck.h:35
+        TransformPointersAsValues(
+            Options.get("TransformPointersAsValues", false)) {}
+
----------------
It may be worth adding some validation to these. If AnalyzeValues, AnalyzeReferences and WarnPointersAsValues are all false, this whole check is basically a no-op.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54943/new/

https://reviews.llvm.org/D54943



More information about the cfe-commits mailing list