This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Respect Cpp11BraceListStyle when aligning array of structures
Needs ReviewPublic

Authored by hch12907 on Mar 10 2023, 10:11 AM.

Details

Summary

When Cpp11BraceListStyle is set to false and AlignArrayOfStructures is
set, the first and last elements of a braced list should not be joined
to the brace.

Fixes #57611.

Diff Detail

Event Timeline

hch12907 created this revision.Mar 10 2023, 10:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 10 2023, 10:11 AM
hch12907 requested review of this revision.Mar 10 2023, 10:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 10 2023, 10:11 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
hch12907 updated this revision to Diff 504238.Mar 10 2023, 11:47 AM

Added unit tests

owenpan added a project: Restricted Project.
MyDeveloperDay added inline comments.Mar 12 2023, 5:39 AM
clang/unittests/Format/FormatTest.cpp
20273

any reason you didn't use verifyFormat here?

hch12907 added inline comments.Mar 13 2023, 1:57 AM
clang/unittests/Format/FormatTest.cpp
20273

No particular reason - I simply copied other tests and modified them to suit the Cpp11BracedListStyle == false case, and one of those tests used EXPECT_EQ.

Should I change it to verifyFormat?

MyDeveloperDay edited the summary of this revision. (Show Details)Mar 22 2023, 3:42 AM
MyDeveloperDay added inline comments.
clang/unittests/Format/FormatTest.cpp
20273

yes please as this tests the code getting messup and putting it back to normal

20276

just because we go over the limit do you think its correct that it pushes this back?