[PATCH] D101868: [clang-format] Adds a formatter for aligning arrays of structs

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 27 04:00:58 PDT 2021


HazardyKnusperkeks added inline comments.


================
Comment at: clang/lib/Format/FormatToken.cpp:86
+      (SplitMax > 0 && SplitMax < ColumnWidth) ? SplitMax : ColumnWidth;
+  ColWidth += (is(tok::comment)) ? 1 : 0;
+  const auto *NextColEntry = Next;
----------------
Personal style, don't know about LLVM. Same below.


================
Comment at: clang/unittests/Format/FormatTest.cpp:16472
+               "    {56,    23, /* a comment */ \"hello\" },\n"
+               "    {-1, 93463,                 \"world\" },\n"
+               "    { 7,     5,                    \"!!\" }\n"
----------------
And a comment after the value?


================
Comment at: clang/unittests/Format/FormatTest.cpp:16478
+               "    {56, /* a comment */ 23, \"hello\" },\n"
+               "    {-1,              93463, \"world\" },\n"
+               "    { 7,                  5,    \"!!\" }\n"
----------------
Or at the line end?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101868/new/

https://reviews.llvm.org/D101868



More information about the cfe-commits mailing list