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

Fred Grim via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 6 14:32:55 PST 2022


feg208 added a comment.

In D121069#3362450 <https://reviews.llvm.org/D121069#3362450>, @MyDeveloperDay wrote:

> @feg208 I could do with some clarity on the algorithm, am I correct in thinking it requires that the first row, to contain at least the maximum number of columns for the rest of the array. I sort of noticed it was fine if the first row was larger
>
>   {
>       {1,2,3 }
>       {4,5}
>       {6}
>   }

Honestly it really is best with the square option. The assumption is an array of simple initializers though default args to constructors complicate that in the case of an array of single constructors. I think that you are seeing it be okay with the maximum as the first row is just an accident of the implementation. The direction I was heading in in the bug I picked up was to start restricting the set of things it would consider as array of initializers. Does that answer your question?


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

https://reviews.llvm.org/D121069



More information about the cfe-commits mailing list