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

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 6 14:01:46 PDT 2018


JonasToth marked an inline comment as done.
JonasToth added inline comments.


================
Comment at: clang-tidy/cppcoreguidelines/ConstCorrectnessCheck.cpp:147
+  // Example: `int i = 10`, `int i` (will be used if program is correct)
+  const auto LocalValDecl = varDecl(unless(anyOf(
+      isLocal(), hasInitializer(anything()), unless(ConstType),
----------------
aaron.ballman wrote:
> JonasToth wrote:
> > @aaron.ballman The change was not valid for some reason. I leave it like it is if thats ok with you.
> That's.... really odd. I am fine leaving it as-is for this patch, but it would be good to understand why that code fails as it seems like a reasonable exposition.
Added a TODO. But maybe i did the transformation incorrectly too. Not all conditions are negative. Maybe all the negative ones can be inverted by demorgan. That should be correct.

I will check this out later.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D45444





More information about the cfe-commits mailing list