[PATCH] D27621: [clang-tidy] check to find declarations declaring more than one name
Firat Kasmis via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 12 05:45:40 PST 2016
firolino added a comment.
In https://reviews.llvm.org/D27621#619649, @malcolm.parsons wrote:
> The fixit construction looks overly complicated.
> All you need to do is change a `,` to a `;` and insert a copy of the type:
>
> << FixItHint::CreateReplacement(CommaRange, ";")
> << FixItHint::CreateInsertionFromRange(VarLocation, TypeRange)
>
>
> and insert some whitespace where needed.
I could do CommaRange = findToken(tok:comma) an do a in-place replacment and thus, get rid of the workaround part as well. But for the TypeRange, I didn't find a proper way to get only the type part. For example, getTypeSourceInfo()->getTypeLoc().getSourceRange() for
const int a(1), b(2);
int const c(3), d(4);
will be
const int
int
I am not able to get the qualifier as well. I even saw something in the source like "we do not provide SourceRange for Qualifiers...". I would like to get rid of getUserWrittenType, but didn't find a way. It gets also dirty for MemberFunctionPointers:
int S::*p = &S::a, S::* const q = &S::a;
const int S::*r = &S::b, S::*t;
int const CS :: * pp = &CS::a, CS::* const qq = &CS::a;
TypeRange will be
int S
int S
int const CS
https://reviews.llvm.org/D27621
More information about the cfe-commits
mailing list