[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
Sun Apr 24 23:12:49 PDT 2022


njames93 added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/misc/ConstCorrectnessCheck.cpp:103
+
+#if 0
+  // FIXME: Remove this section if there are no crashes after the iterator-fix.
----------------
Hasn't this already been addressed, if so can this block just be removed.


================
Comment at: clang-tools-extra/docs/ReleaseNotes.rst:103
 - New :doc:`bugprone-shared-ptr-array-mismatch <clang-tidy/checks/bugprone-shared-ptr-array-mismatch>` check.
-
   Finds initializations of C++ shared pointers to non-array type that are initialized with an array.
----------------
Unrelated change.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/list.rst:87
    `bugprone-reserved-identifier <bugprone-reserved-identifier.html>`_, "Yes"
-   `bugprone-shared-ptr-array-mismatch <bugprone-shared-ptr-array-mismatch.html>`_, "Yes"
    `bugprone-signal-handler <bugprone-signal-handler.html>`_,
----------------
This should be committed separately.


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/misc-const-correctness-transform-values.cpp:27
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: variable 'p_local0' of type 'int' can be declared 'const'
+  // CHECK-FIXES: const
+}
----------------
This check directive isn't going to be effective.
Try `CHECK-FIXES: const int p_local0 = 2;`
Same goes for all the ones below.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D54943



More information about the cfe-commits mailing list