[PATCH] D24501: Remove redundant comma around parenthesis in parameter list.

Daniel Jasper via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 13 05:45:30 PDT 2016


djasper added inline comments.

================
Comment at: unittests/Format/CleanupTest.cpp:147
@@ +146,3 @@
+  // Trailing comma in braces is not removed.
+  std::string Code = "void f() { std::vector<int> v = {1,2,,,3,{4,5,}}; }";
+  std::string Expected = "void f() { std::vector<int> v = {1,2,3,{4,5,}}; }";
----------------
Seems like it's worth to pull out a function getting (offset, input, expected output) and then doing all this. Of course doesn't *have* to be in this patch, but I guess now is as good a time as any.

Once that is done and we don't need to duplicate so much code, I think it might be worth duplicating this test to have it with and without trailing comma.

Also, I think there is actually a FIXME here. Lets assume I mark the offset that you put into ranges as X, then I think:
- {a, b, X} should lead to {a, b}
- {a, b, X,} should lead to {a, b,}
Does that make sense?


https://reviews.llvm.org/D24501





More information about the cfe-commits mailing list