[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 01:44:41 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);
+      }
----------------
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>> = {{...}, {...}}`?


http://reviews.llvm.org/D19804





More information about the cfe-commits mailing list