[PATCH] D151761: clang-format: Add AlignConsecutiveShortCaseStatements

Galen Elias via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 12 16:51:36 PDT 2023


galenelias updated this revision to Diff 530707.
galenelias edited the summary of this revision.
galenelias added a comment.

Ok, I added the ability to align the case label colons.  In your original message you mentioned "I'd like to align the colon (and thus the statement behind that)" which implies actually adding the whitespace after the 'case' token itself.  Not sure if that would still be your preference in an ideal world, or if I just misinterpreted your request.  Aligning the colons themselves is very straightforward.

I opted to make this an option on `AlignConsecutiveStyle`, as that is consistent with how we customize some of the other AlignConsecutive* options, and it seemed awkward to add a floating top level boolean config option which applied to just this scenario - although it has the similar downside that it muddies the AlignConsecutiveStyle options for the other use cases.


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

https://reviews.llvm.org/D151761

Files:
  clang/docs/ClangFormatStyleOptions.rst
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Format/Format.h
  clang/lib/Format/Format.cpp
  clang/lib/Format/WhitespaceManager.cpp
  clang/lib/Format/WhitespaceManager.h
  clang/unittests/Format/ConfigParseTest.cpp
  clang/unittests/Format/FormatTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151761.530707.patch
Type: text/x-patch
Size: 26559 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230612/a874efa6/attachment-0001.bin>


More information about the cfe-commits mailing list