[PATCH] D19804: Make clang-format cleaner remove redundant commas in list and redundant colon in constructor initializer.
Eric Liu via cfe-commits
cfe-commits at lists.llvm.org
Fri May 13 02:08:05 PDT 2016
ioeric added inline comments.
================
Comment at: lib/Format/Format.cpp:1822
@@ +1821,3 @@
+ cleanupRight(Line->First, Line->Last, tok::comma, tok::comma);
+ checkConstructorInitList(*Line);
+ }
----------------
ioeric wrote:
> djasper wrote:
> > You could turn this into:
> >
> > for (auto &Line : AnnotatedLines) {
> > if (Line->Affected) {
> > cleanupRight(Line->First, tok::comma, tok::comma);
> > cleanupRight(Line->First, TT_CtorInitializerColon, tok::comma);
> > cleanupLeft(Line->First, tok::comma, tok::l_brace);
> > cleanupLeft(Line->First, TT_CtorInitializerColon, tok::l_brace);
> > }
> > }
> Wouldn't `cleanupLeft(Line->First, tok::comma, tok::l_brace);` also remove the comma from `std::vector<std::vector<int>> = {{...}, {...}}`?
I should've added this case into unit test, sorry...
But I think we can either handle constructor initializer's tok::l_brace specially or annotate it? The later solution can enable us to do `cleanupLeft(Line->First, tok::comma, TT_CtorInitializerLBrace);`.
http://reviews.llvm.org/D19804
More information about the cfe-commits
mailing list