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

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 11 08:37:48 PST 2020


JonasToth added a comment.

@0x8000-0000 i did remove `dependentTypes` from matching. Locally that works with your reported test-case (i was running clang-tidy wrong :().

I do understand the `auto &` issues now (i think).
If the type is deduced to a template-type or something that depends the standard ways of detecting that do not work, because in each template instantiation this information is not available.

Having a `auto & local = TemplatedVariable` does not have the `isInstantiationDependentType()`-bits set and for each instantiation of the template the const-analysis is run.
The false positives happened in different template instantiations, i think because the overloaded operators were sometimes `const` and sometimes not. I tried many ways to detect, if the type comes from a template, but had no success.
This is probably an issue in `Sema` or requires adjustments there.
I added tests in clang-tidy, but `#if 0` them out because are not working right now.


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