[PATCH] D158795: Fix AlignArrayOfStructures + Cpp11BracedListStyle=false
Owen Pan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 25 13:19:44 PDT 2023
owenpan added a comment.
> I'm not exactly sure why this function needs to override the Spaces as it seems to generally already be set to either 0 or 1 according to the other formatting settings
If so, can we address the issue without the "explicit fix"?
================
Comment at: clang/lib/Format/WhitespaceManager.cpp:1229
+ const auto BracePadding = Style.Cpp11BracedListStyle ? 0 : 1;
auto &Cells = CellDescs.Cells;
----------------
================
Comment at: clang/lib/Format/WhitespaceManager.cpp:1247
if (Previous && Previous->isNot(TT_LineComment)) {
- Changes[Next->Index].Spaces = 0;
+ Changes[Next->Index].Spaces = BracePadding;
Changes[Next->Index].NewlinesBefore = 0;
----------------
Can we assert that `Spaces == 0`? If not, we should add a test case.
================
Comment at: clang/lib/Format/WhitespaceManager.cpp:1303
+ const auto BracePadding = Style.Cpp11BracedListStyle ? 0 : 1;
auto &Cells = CellDescs.Cells;
----------------
Ditto.
================
Comment at: clang/unittests/Format/FormatTest.cpp:20888
+ " { 7, 5, \"!!\" }\n"
+ "};\n",
+ Style);
----------------
================
Comment at: clang/unittests/Format/FormatTest.cpp:21130
+ " { 7, 5, \"!!\" }\n"
+ "};\n",
+ Style);
----------------
Ditto.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D158795/new/
https://reviews.llvm.org/D158795
More information about the cfe-commits
mailing list