<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/85123>85123</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-format] Incorrect indentation after a closing paren with Align ConsecutiveDeclarations + TrailingComments
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ameerj
</td>
</tr>
</table>
<pre>
In a scenario such as this:
```c++
void foo(
int name, // name
float name, // name
int name) // name
{
}
```
The final trailing comment is incorrectly formatted when both `AlignConsecutiveDeclarations` and `AlignTrailingComments` are enabled.
The formatted output:
```c++
void foo(int name, // name
float name, // name
int name) // name
{}
// EXPECTED
void foo(int name, // name
float name, // name
int name) // name
{}
```
It seems to be that the trailing comment's doesn't gets its `StartOfTokenColumn` value properly updated by the time `WhitespaceManager::alignTrailingComments` is invoked:
https://github.com/llvm/llvm-project/blob/0b4688403672264ab451992a3461a0df113c3bd7/clang/lib/Format/WhitespaceManager.cpp#L1111
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVE1v5DYM_TXyhdiBLX8ffEhmYiBAixZogPZKy7StXVkyJHoW-feF7c202XSDTQeCxpIo6vE9khiCHi1RI_J7kV8iXHlyvsGZyH-OOtc_N48WEIIii147CKuaAAPwpINI70R8EfGdKOJjKCHvt7HvXp3uYXBOyOrYAADQlsHiTEKeQchWyPZYHgaDcfje-SsH9VsDUd6_fFy-g3YsnyaCQVs0wB610XYE5eaZLIMOoK1y3pNi8wyD8zMyUw9fJ7LQOZ5AFPGd0aM9OxtIrayvdCFl0CNrZ4MoYkDb38yevj1xPl44zj0BWewM9ad_Qbo95lZeVv55Zjc64H3G9t9PMAsv9MKNYPhvim_kHvNh8vDX7w_np4fLhyH-P2jvA3ut-jE_MgSiOQA76Ah4Qgae6E0mCFkG6B0FK2TJMBIH0Bw2Wf9g9Pzb8OS-kD07s8520_SKZiVYvFvIm2dYlx43Kbvnw72eabv756SZwoKKfkWLI_lN5PQOf5Qpez5e3Rfqb9kwMS971e2xj5qntTspNwvZGnN9-fu0ePeZFAvZdsZ1QrZxlxVVlcVpUUpZZNhleVLXEtOsSDDuhyRJVdr1pZCtMmjHzZHeLrZ7XgrZvgF_UssiZPpLkiRJ1DdpX6c1RtQkZRKneZlleTQ18UCprPM461VcdaouyqGiQSUVqYzqIo90I2OZxWmSJnVSyuyUVjGqIU2LasCkrzKRxTSjNqctsJPzY6RDWKmp8kSmkcGOTNh7l5Q78k_DN8Ry62a-2fno1jGILDY6cPjHEWs2e997dTG_wONLFwBte7K8FzfgwOQBQRkXtmRZ0JOFr5on2IsdftAUQMh7-F5fiFZvmg_LuccehGz38P8OAAD__-Hzv30">