[PATCH] D121069: [clang-format] Minimize the damage caused by AlignArrayOfStructures when working on non square arrays

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 6 08:41:13 PST 2022


MyDeveloperDay added inline comments.


================
Comment at: clang/lib/Format/WhitespaceManager.cpp:1118
     Changes[CellIter->Index].Spaces = CellDescs.InitialSpaces;
   ++CellIter;
+  for (auto i = 1U; i < CellDescs.CellCounts[0]; i++, ++CellIter) {
----------------
I don't understand in Left alignment why we ignore the first cell, but in right alignment, we don't!


================
Comment at: clang/lib/Format/WhitespaceManager.h:321
+      }
       auto Start = (CellStart + RowCount * CellCount);
       auto End = Start + Offset;
----------------
Ultimately these calculations are incorrect unless every CellCount for every row is the same, and for non-square they are not, this always had me confused as to why it starts at 1? 


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

https://reviews.llvm.org/D121069



More information about the cfe-commits mailing list