I realize this is an ancient thread, but I ran into this issue as well recently while changing some larger switch statements and had to just ignore the clang-format warnings on the pull request.
Since Clang17, it appears there is a AlignConsecutiveShortCaseStatements setting which would generate the style listed in the initial post.
I would be in favour of updating the coding style to the following:
AllowShortCaseLabelsOnASingleLine: true
AlignConsecutiveShortCaseStatements:
Enabled: true
AcrossEmptyLines: true
AcrossComments: true
AlignCaseColons: false
It seems the single-line case statements are still very common in LLVM:
❯ git grep -E '^\scase\s+.+((return.;)|(break;))$' lib | wc -l
6733
I tried reformatting all of llvm/lib with the clang format config above and we now get almost 4x as many single line cases (rought estimate is that this is about 20% of all case statements).
❯ git grep -E '^\s*case\s+.+((return.*;)|(break;))$' lib | wc -l
24676
Counter-point against changing: this data means right now we are only using single-line case statements 25% of the time, so maybe too much time has passed and we should just stick to the style clang-format has mandated for the past years?