[PATCH] D151761: clang-format: Add AlignConsecutiveShortCaseStatements

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 24 09:52:43 PDT 2023


owenpan accepted this revision.
owenpan added a comment.

In D151761#4528389 <https://reviews.llvm.org/D151761#4528389>, @galenelias wrote:

> In D151761#4524653 <https://reviews.llvm.org/D151761#4524653>, @owenpan wrote:
>
>> FWIW, I think we can use a shorter name `AlignConsecutiveCaseStatements` instead of `AlignConsecutiveShortCaseStatements`.
>
> My only hesitation with that name is that it might seem like something like there should be some alignment being applied to 'normal' consecutive case statements, which there isn't.  Maybe it's fine because the documentation makes it clear?  I'm definitely not picky about the name, whatever sounds idiomatic.  @HazardyKnusperkeks, thoughts on just `AlignConsecutiveCaseStatements`?
>
>   switch (level) {
>   case 0:
>   case 100:
>      return "error";
>   }

Strictly speaking, `case 0:` in the example above is an empty `case` statement, so if we really want to be precise and verbose, we should use `AlignConsecutiveNonEmptyCaseStatements` or even `AlignConsecutiveNonEmptyShortCaseStatements`? I still prefer the shorter `AlignConsecutiveCaseStatements`, but will leave it to others.


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

https://reviews.llvm.org/D151761



More information about the cfe-commits mailing list