[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 15:13:04 PST 2016
firolino marked an inline comment as done.
firolino added inline comments.
================
Comment at: clang-tidy/readability/OneNamePerDeclarationCheck.cpp:87
+ Diag << FixItHint::CreateReplacement(CommaRange, ";")
+ << FixItHint::CreateReplacement(AfterCommaToVarNameRange,
+ "\n" + CurrentIndent +
----------------
malcolm.parsons wrote:
> Is an insert simpler?
> ```
> FixItHint::CreateInsertion(CommaLocation.getLocWithOffset(1),
> "\n" + CurrentIndent + UserWrittenType + " ");
> ```
Won't work, if there are whitespaces between comma and variable name. I need to get those first and ltrim() them.
The insert would give for:
```
int a,b;
int aa, bb;
int xk = 1,
yk = 2;
```
->
```
int a;
int b;
int aa;
int bb;
int xk = 1;
int
yk = 2;
```
https://reviews.llvm.org/D27621
More information about the cfe-commits
mailing list