[PATCH] D50953: [clang-tidy] Handle sugared reference types in ExprMutationAnalyzer

Shuai Wang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 11 11:03:30 PDT 2018


shuaiwang added a comment.

In https://reviews.llvm.org/D50953#1230138, @JonasToth wrote:

> In https://reviews.llvm.org/D50953#1230003, @shuaiwang wrote:
>
> > In https://reviews.llvm.org/D50953#1229287, @JonasToth wrote:
> >
> > > What happens to pointers in a typedef (in the sense of `*` instead of `&`)?
> >
> >
> > I checked around and I believe reference type is the only type we're explicitly matching right now. We'll need to handle carefully when handling pointer types in the future.
>
>
> We match on pointers as values. So figure this out `int * >const< ptr = nullptr`.
>  And the constness transformation is especially intersting for pointer typedefs, because in `typedef int * IntPtr; const IntPtr p1; IntPtr const p2;` p1 and p2 are  different things. It would be nice if you could check, that the value semantic of the pointer is detected through the typedef as well.


Added test cases verifying we're treating pointers as values.
I feel constness doesn't matter much since we're treating them as values and both const values & non-const values are just values.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D50953





More information about the cfe-commits mailing list