<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/71563>71563</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[FR] clang-format option for line breaks after [[attributes]] in function scope
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
FalcoGer
</td>
</tr>
</table>
<pre>
Currently there is no clang-format option for attributes like `[[maybe_unused]]` or `[[likely]]`. Right now clang-format will always force them onto the same line as the item.
```c++
int main()
{
[[maybe_unused]]
int y = 5;
[[likely]]
if (5 == 5) {}
else {}
}
```
will always end up as, with no option to change the behavior
```c++
int main()
{
[[maybe_unused]] int y = 5;
[[likely]] if (5 == 5) {}
else {}
// ~~~~
// ^ Different indentation for 'if' and corresponding 'else' (clang-tidy readability-misleading-indentation)
}
```
This is especially bothersome for the `if` because it leads to clang-tidy to report the misleading indentation.
It would be nice if there were an option for line breaks after such attributes.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVE-PmzoQ_zTmMkrkmADJgcPL5uXpXVe9V4MZwF1jI9tsxCWfvTJJE6LtVmorWWDNH8_8ZuY36L1qDVHJsgPLjgmOobOuPKGW9j9ySWXrqXwZnSMT9AShI0egPBgLUqNpV411PQawQ1DWQGMdYAhOVWMgD1q9EbCcz48fepwq-jqa0VPNsmM8OQfrHhbRXk933RpeVdsFMPb8HO2stAbUZ5x8DCkpJtaDNcHGG3jsCbQyBOhngQrUrxk_Mv7P7Zvz65FMHOKZpcoE6FEZJnZM7G-WxU0Jn6K4qgEg-k_A0iNkLD0s40XtTzA-PBtgYpdF36u72EOMXCxsSHt6Ej4uP9AsQy6LRKaGcQD0TLzAWYUuNvDWs2BBdmjauYhQUYfvyrq_LdYd78d6_XaZ_rA64sTECS6Xy-VJACz7F46qaSgONShTkwl4H18mCtUwUQCaGqR1jvxgTa1MG1UxSlQysbtOZFD1BI6wxkppFaZVr7wmjParxdOLCv2qZ1865SO9yA8kFWo9QWUj6bztaU4v9ojlXDWROxVJHH0cb4gx_dzLR1rBgqPBujB7PRJbYn5ixf8BznbUNVQERkmKhb9S_hw_aJY8n_lVOcI3D9gEcuBH2S3ov07qMq336R4TKjf5fp8Wu4znSVfuOG-aXY1bUaAQUlYcN3IvBKZExGWeqFJwkW42vNgUacbz9ZZ4ta3TrCiarC5yzracelR6rfV7v7auTZT3I5XFJsvTRGNF2s87TYjl5mBCxC3nyui2qsbWsy3Xygf_eCiooOd9eHqNs_fZmvsI_zq4D_z3aYdmNHJ29NIOlIxOl10Ig2fpbShbFbqxWkvbM3GKmdx-q8HZbyQDE6cZn2fiNEP8HgAA__-ujboG">