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

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 26 23:49:57 PDT 2022


sammccall added a comment.

This check is enabled by default in LLVM (`Checks: misc-*` in `llvm-project/.clang-tidy`)

The warning on mutable non-ref local variables is pretty noisy: a *lot* of existing code does not do this, for defensible reasons (some of us think that the ratio of extra safety to extra syntactic noise for locals is too low). The LLVM style guide doesn't take a position on this.

Should this check

- be disabled for LLVM? (i.e. this is opt-in for codebases with strong const-correctness rules, LLVM does not, it was unintentionally enabled by `misc-*`)
- be configured only to warn on references? (i.e. we expect that is de-facto LLVM style and so uncontroversial)


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