[PATCH] D33491: clang-format: Fix C99 designated initializers corner cases

Daniel Jasper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 19 03:21:34 PDT 2017


djasper added inline comments.


================
Comment at: lib/Format/TokenAnnotator.cpp:339
         Left->Type = TT_JsComputedPropertyName;
+      } else if ((Style.Language == FormatStyle::LK_Cpp ||
+                  Style.Language == FormatStyle::LK_ObjC) &&
----------------
Use Style.isCpp().


================
Comment at: unittests/Format/FormatTest.cpp:1526
+  verifyFormat("const struct A a = {[0] = 1, [1] = 2};");
+  verifyFormat("const struct A a = {[1] = aaaaaaaaa,\n"
+               "                    [2] = bbbbbbbbb,\n"
----------------
Typz wrote:
> don't know why this test does not pass similarly to similar one with designated member access: in this case, clang-format puts each member in column.
I don't understand what you mean here.


https://reviews.llvm.org/D33491





More information about the cfe-commits mailing list