[PATCH] D25316: [clang-tidy] Fix PR25499: Enhance modernize-use-auto to casts

Piotr Padlewski via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 7 02:38:48 PDT 2016


Prazek added a comment.

In https://reviews.llvm.org/D25316#564217, @malcolm.parsons wrote:

> In https://reviews.llvm.org/D25316#563930, @Prazek wrote:
>
> > Please add tests with
> >
> >   long long p = static_cast<long long>(4);
> >   
> >
> > and the same with const at beginning. I remember I had problems with this last time (Type->SourceRange was returning only source range for the first token.
>
>
> BuiltinTypeLoc only returns the first token:
>
>   SourceRange getLocalSourceRange() const {
>     return SourceRange(getBuiltinLoc(), getBuiltinLoc());
>   }
>   
>
> The existing check fails too:
>
>   -long long *ll = new long long();
>   +auto long *ll = new long long();


Interesting! I remember checking it half year ago, and it was working (SourceRange was returning all tokens from first one
to asterisk). I remember there was some small features introduced, like instead of
auto p = long long new;
to produce
auto *p = long long new;

Maybe it was introduced in that patch. Anyway I think this have to be fixed somehow. Either by playing with lexer, or by fixing sourceRange


https://reviews.llvm.org/D25316





More information about the cfe-commits mailing list