[PATCH] D151761: clang-format: Add AlignConsecutiveShortCaseLabels

Galen Elias via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 31 15:06:04 PDT 2023


galenelias added a comment.

In D151761#4385163 <https://reviews.llvm.org/D151761#4385163>, @HazardyKnusperkeks wrote:

> When I read the title I thought "Yay, some one is doing what I want and don't find the time.", but (for me) sadly you're not.
> I'd like to align the colon (and thus the statement behind that). Do you think you can add that option too?

Hmm, it had not occurred to me that there are folks who would want to insert the spaces after the 'case'.  I can think about how that might be accomplished, but it doesn't seem straightforward given the current alignment infrastructure since the token you want to align (the colon) isn't the token which should be padded (the token after the case keyword).  I think I'd have to write custom alignment code to allow for the separation of these two.



================
Comment at: clang/include/clang/Format/Format.h:308
+  /// \version 17
+  AlignConsecutiveStyle AlignConsecutiveShortCaseLabels;
 
----------------
HazardyKnusperkeks wrote:
> We need another name, you're not aligning the label, but the statement.
I was taking the name from the GitHub issue, which while I agree is a slight misnomer seemed to yield what I assumed most people would expect.  I guess `AlignConsecutiveStatementsAfterShortCaseLabels` is more correct, but is also getting pretty verbose.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151761



More information about the cfe-commits mailing list