[PATCH] D121069: [clang-format] Minimize the damage caused by AlignArrayOfStructures when working on non square arrays
Marek Kurdej via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Mar 6 05:29:55 PST 2022
curdeius added inline comments.
================
Comment at: clang/lib/Format/WhitespaceManager.h:204
+ // of columns as the first row
+ bool IsSquare() {
+ if (CellCounts.empty())
----------------
Don't really like the name...
Some suggestions:
- HasEqualRows
- HasEqualRowLengths
- HasSameRowLengths
- IsRectangular
================
Comment at: clang/unittests/Format/FormatTest.cpp:25309
+
+ // TODO don't adjust this non square array
+ verifyFormat("struct test demo[] = {\n"
----------------
Not sure I understand the comment here, this formatting looks ok, no?
================
Comment at: clang/unittests/Format/FormatTest.cpp:25340
+ // TODO don't adjust this non square array
+ verifyFormat("struct test demo[] = {\n"
+ " {1, 2, 3},\n"
----------------
This one is "square", isn't it?
I think you wanted to omit 3 in the first row
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D121069/new/
https://reviews.llvm.org/D121069
More information about the cfe-commits
mailing list