[PATCH] D45444: [clang-tidy] implement new check for const-correctness

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 3 04:41:32 PST 2019


JonasToth added a comment.

In D45444#1766156 <https://reviews.llvm.org/D45444#1766156>, @0x8000-0000 wrote:

> Thank you for rebasing on current master.
>
> I have ran it today on our code base and found three classes of false positives:
>
> 1. Writing to a bitfield of a struct. The struct still is suggested it should be const.
> 2. Using a variable with an ostream extraction; like "int foo; cin >> foo;", except it was a template on the stream instance.
> 3. In a for loop, with a somewhat strange pair (for auto [foo, bar] = std::pair {}; foo < big_foo; ++ foo).
>
>   Let me know if you can't create test cases from these descriptions and I can try to extract the code.


Thank you for testing, I would appreciate if you test later versions, too!
I will focus on landing the utility function for adding `const` first. I noticed false positives in LLVM as well, I try to reproduce them all and fix/workaround the issues.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D45444





More information about the cfe-commits mailing list