[PATCH] D51949: [WIP][clang-tidy] initial ideas to isolate variable declarations

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 13 13:26:26 PDT 2018


lebedev.ri added a comment.

In https://reviews.llvm.org/D51949#1233951, @JonasToth wrote:

> Yes, do you think it should be included in the diag?


Yes, please :) Else, the message seems a bit too empty.
I **don't** think it should point (via `NOTE:`) at the each decl though.

> Am 13.09.2018 um 22:09 schrieb Roman Lebedev via Phabricator:
> 
>> lebedev.ri added inline comments.
>> 
>> ================
>>  Comment at: clang-tidy/readability/IsolateDeclCheck.cpp:200
>>  +
>>  +  diag(WholeDecl->getBeginLoc(), "make only one declaration per statement")
>>  +      << FixItHint::CreateReplacement(WholeDecl->getSourceRange(), Replacement);
>> 
>>  ----------------
>> 
>> I think you can get the count of declarations via `std::distance(WholeDecl->decl_begin(), WholeDecl->decl_end())`.
>> 
>> Repository:
>> 
>>   rCTE Clang Tools Extra
>> 
>> https://reviews.llvm.org/D51949




Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51949





More information about the cfe-commits mailing list