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

Fred Grim via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 6 16:45:49 PDT 2021


feg208 added a comment.

I have a few outstanding questions about additional testing



================
Comment at: clang/unittests/Format/FormatTest.cpp:16371
+               Style);
+}
+
----------------
HazardyKnusperkeks wrote:
> curdeius wrote:
> > I think we need more tests:
> > * with a comma after the last element of array
> > * with assignment and not only initialization?
> > * without `struct` keyword
> > * with short lines/long values to see how wrapping behaves
> >   * also, with multiple string literals in one struct, e.g. `"hello" "world"` (that will get splitted into multiple lines)
> > * with non-plain-array types (i.e. missing `[]`/`[3]`)
> > * interaction with other Align* options (e.g. `AlignConsecutiveAssignments`, two arrays one after another, `AlignConsecutiveDeclarations`).
> In addition to that I want to see:
> * How it behaves with a smaller column limit which would be violated if there is no additional wrapping. There I also want one without `verifyFormat`.
> * With no column limit.
> * Maybe with a `const`, `inline` or something similar. (How about east `const` vs. west `const`?)
I added

  - with a comma after the last element of array
  - with assignment and not only initialization?
  - without struct keyword
  - with short lines/long values to see how wrapping behaves (also multiple string literals) But I still should add another test I think
  - with non-plain-array types (i.e. missing []/[3])
  - interaction with other Align* options (e.g. AlignConsecutiveAssignments, two arrays one after another, AlignConsecutiveDeclarations). I will say that I did this in a brute force way. Maybe there is something else I should do here?
  - With no column limit.

I still need tests with east and west const and without verifyFormat. For the latter is there an example test I could look at? Idly scrolling through FormatTest.cpp it seems like most stuff uses verifyFormat? Or maybe I misunderstood the request?


















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