[PATCH] D54943: [clang-tidy] implement const-transformation for cppcoreguidelines-const-correctness

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 27 04:04:30 PST 2018


JonasToth created this revision.
JonasToth added reviewers: alexfh, aaron.ballman, hokein, shuaiwang, lebedev.ri.
Herald added subscribers: cfe-commits, kbarton, xazax.hun, mgorny, nemanjai.

This patch connects the check for const-correctness with the new general
utility to add const to variables.
The code-transformation is only done, if the detected variable for const-ness
is not part of a group-declaration.

This patch (in combination with readability-isolate-declaration) shows some
false positives of the ExprMutAnalyzer that should be addressed, as they
result in wrong code-transformation.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D54943

Files:
  clang-tidy/cppcoreguidelines/CMakeLists.txt
  clang-tidy/cppcoreguidelines/ConstCorrectnessCheck.cpp
  clang-tidy/cppcoreguidelines/ConstCorrectnessCheck.h
  clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp
  clang-tidy/performance/ForRangeCopyCheck.cpp
  clang-tidy/performance/UnnecessaryCopyInitialization.cpp
  clang-tidy/performance/UnnecessaryValueParamCheck.cpp
  clang-tidy/utils/FixItHintUtils.cpp
  clang-tidy/utils/FixItHintUtils.h
  clang-tidy/utils/LexerUtils.cpp
  clang-tidy/utils/LexerUtils.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/cppcoreguidelines-const-correctness.rst
  docs/clang-tidy/checks/list.rst
  test/clang-tidy/cppcoreguidelines-const-correctness-pointer-as-values.cpp
  test/clang-tidy/cppcoreguidelines-const-correctness-transform-pointer-as-values.cpp
  test/clang-tidy/cppcoreguidelines-const-correctness-transform-values.cpp
  test/clang-tidy/cppcoreguidelines-const-correctness-values.cpp
  unittests/clang-tidy/AddConstTest.cpp
  unittests/clang-tidy/CMakeLists.txt

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54943.175448.patch
Type: text/x-patch
Size: 93950 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181127/30636134/attachment-0001.bin>


More information about the cfe-commits mailing list