[clang-format] Misaligned trailing comment on default case with `AlignConsecutiveShortCaseStatements`
Open
clang-format
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
With this config:
```yaml
AllowShortCaseLabelsOnASingleLine: true
AlignConsecutiveShortCaseStatements:
Enabled: true
```
Trailing comments on "short default statements" are misaligned if other trailing comments are present.
For this to occur *at least one* case label has to be longer than the `default` label.
```cpp
switch (state) {
case State::Idle: return 1; // Aligned
case State::Running: return 2; // Aligned
default: return 3; // Oops!
};
```
Interestingly, the alignment is only affected by the length of the case label, not the whole statement.
*Tested with version `18.1.3 (Ubuntu)` and `22.0.0git (commit 3c39187)`*
Contributor guide
Assessment
This issue has not been assessed yet.