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

Florin Iucha via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 11 09:06:22 PST 2020


0x8000-0000 added a comment.

In D54943#1815568 <https://reviews.llvm.org/D54943#1815568>, @JonasToth wrote:

> @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.


Thank you for looking into this; I'll start building diff14 to test locally.

I'm good with merging this checker as-is, as long as it is not enabled by default. I want to be able to use it even partially, in environments where I might not be able to inject a home-built compiler ;)


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