[PATCH] clang-format: Add ability to align assignment operators

Daniel Jasper djasper at google.com
Mon Apr 13 03:46:07 PDT 2015


I don't think that that would be an acceptable solution as types can be more complicated, e.g. they can be "const" or templated.

Also, you are still missing test-cases where the assignment statements are multi-line.


================
Comment at: unittests/Format/FormatTest.cpp:8371
@@ +8370,3 @@
+               "dvsdsv          |= 5;\n"
+               "int dsvvdvsdvvv = 123;", Alignment);
+  verifyFormat("int i     = 1, j = 10;\n"
----------------
I don't know whether you'd really want to align the other assigments as well. If you do, wouldn't it be better to align on the "="?

================
Comment at: unittests/Format/FormatTest.cpp:8372-8373
@@ +8371,4 @@
+               "int dsvvdvsdvvv = 123;", Alignment);
+  verifyFormat("int i     = 1, j = 10;\n"
+               "something = 2000;", Alignment);
+  verifyFormat("something = 2000;\n"
----------------
Do you really think that this behavior is a good idea?

================
Comment at: unittests/Format/FormatTest.cpp:8410
@@ +8409,3 @@
+               "  int aaaa       = 12; \\\n"
+               "  int b          = 23; \\\n"
+               "  int ccc        = 23; \\\n"
----------------
Replace 23 by 234 or something..

http://reviews.llvm.org/D8821

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list