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

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 21 05:11:00 PST 2022


JonasToth added a comment.

Another full run on LLVM with:

  $ ./clang-tools-extra/clang-tidy/tool/run-clang-tidy.py \
        -clang-tidy-binary ~/software/llvm-project/build_clang_tidy/bin/clang-tidy \
        -checks="-*,cppcoreguidelines-const-correctness" \
        -config "{CheckOptions: [{key: 'cppcoreguidelines-const-correctness.TransformValues', value: 1}, {key: 'cppcoreguidelines-const-correctness.TransformReferences', value: 1}, {key: 'cppcoreguidelines-const-correctness.WarnPointersAsValues', value: true}, {key: 'cppcoreguidelines-const-correctness.TransformPointersAsValues', value: true}]}" \
        -fix 2>&1 | tee ../transformation.log

Yields to this: ` 3822 files changed, 159256 insertions(+), 159256 deletions(-)`
and requires manual changes:
F22182704: to_fix.patch <https://reviews.llvm.org/F22182704>
 23 files changed, 45 insertions(+), 45 deletions(-)

the issues were:

- missing `{}` initialization after a variable became `const` if a destructor was missing
- the analysis got confused for some `insert(llvm::Function* f)` calls and made the objects `const`. Those are false positives, but with a really low rate

after applying the patch `ninja check-all` is successfull.


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