<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/161973>161973</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang-format] Misaligned trailing comment on default case with `AlignConsecutiveShortCaseStatements`
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-format
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          Alunderin
      </td>
    </tr>
</table>

<pre>
    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)`*
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMVE1v4zYQ_TWjyyACRVmSddCBSWpggS0WaLbomZJGEguaNMhRgvz7grQTb7t7KGHA-pg3M-_NPOkYzeqIBmgeoXku9M6bD4Oyu5spGFeMfn4f_jK8IW8m4uTdYlaoFQgFrbj-3vXZglDKWv_2svnATzrSVz2Sjd-cejFutfTVOIJaIYedcqxZ3ZN3kaadzSt9wl5YM53JcbwWQfzN6dHS_AP4s3C6Fup70MYat-LkzxmJ3iFIGVNOnGnRu2WM98RSog6EZxN1aoNmNAt63igg_5QrRV4CRXJcglAnH65KsEc_TXtAkEozWtKR0TsCqXDSkdAmAXDTOXQktN6tqcKmHfJGCK249QatuEaXV0Kf_KbLBYSKb4anDUEeMweQPUL3CELlMlmwpFWtvsw2a4yIgXgPDiuoHxHkCeQJ1ZXrL3B_7M4Zl6b6gZO_xH20ey3xeW6YOmF-PDf8N3-JIKvEq3uG-vHnAX5xTIEip0V5B_mU5cmjSSNAkwZq31EvC01MM47vOcKSW3lDv-S7u-Ypg_Ocn75t3tJ99h8CS_WdYkr1ljb7lUI0aWdaUR3LqqyT1n-Ou-MdZJ-mo92c3kpZilKshlNA2hDDWE91Xx27ayBIVcxDPfd1rwsaqq7pW3Fsjn2xDeN8pObQdtQ04tDqpjvImrp-7mStl6UThRmkkE0lxEEK0R_68thMVb_MfU_V2Mz1CAdBZ21sae3rufRhLUyMOw1VW_VdXWTyMTtZyslqtz4sPpw1g5TJ22FIuIdxXyMchDWR4z0TG7b5K_AvYPOMv99d8l9zJJ992CvLn9WEVvwfd7ei2IMdNuZLtnpeltXwto_l5M8gT6m329_DJfi_aWKQp0w5gjzdWL8O8p8AAAD__733g1o">