<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/92657>92657</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-format cannot format attributes on lambdas
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
nico
</td>
</tr>
</table>
<pre>
Input:
```
% cat test.cc
void CanonicalCode::write_symbol(LittleEndianOutputBitStream& bit_stream, u32 symbol) const
{
m_code.visit(
[&](u32 single_code) __attribute__((always_inline)) -> void {},
[&](Compress::CanonicalCode const& code) __attribute__((always_inline)) {});
}
```
clang-format strips the spaces around `->`:
```
% ~/src/llvm-project/out/gn/bin/clang-format test.cc
void CanonicalCode::write_symbol(LittleEndianOutputBitStream& bit_stream, u32 symbol) const
{
m_code.visit(
[&](u32 single_code) __attribute__((always_inline))->void {},
[&](Compress::CanonicalCode const& code) __attribute__((always_inline)) {});
}
```
This is with today's HEAD (58c778565cd64a69ea86e7e67e6a87fff3b0b224), but it also repros with older clang-formats.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkVMGOozgQ_RpzKXVECrDhwKGTdLQrrbSH3TsyxiReGRvZRbdy2W8fmZDpbs1IozmOBqEShV3vVbleWcZoLk7rllUHVp0yudDVh9YZ5bPeD7f2TzcvxIpnlp9Y_rA83967ixUoSUA60k6p-89XbwY4SuedUdIe_aATSPH8FgzpLt6m3luG9V-GyOoXNxjp_l5oXuhg6B8KWk4MOfSGurh5R1gKhEdkA8q7SFsG4nD_AACYOuUHvXs10RDD-n0hPalM5Kw6MaxXOOMuVq8RCbPrJFEw_UK661Iw1tK-yVvsjLPGpT1p2xMrXmCtMDGLE8PjRvMR_-inOegY74V_OosteeTwk8wPvoYVh0ftp-93ZbXKSnd5Gn2YJEGkYOYIdNUQZ6l0BBn84gZgPE8lpdgfdvp_hucYFMOzta_T0xz8f1oRw7Nfkr04hufeJPuJ-7cRRzrIX0Ia_15NBBPhzdAVyA_yxlBE-OPl-QQM66pWQtQVr9TAS8kbLWuuheZCc1mLcRyLPu8Ry5X9CP1CYAikjR6CnoPfgL0ddICPUoi7bGiLoSkamel2L_Y8LxuxL7JrO1TVkGOj-rFRIxe5ELoYuaj6qh7FyPPMtJhjmVf7es-xLoqdKve84vXQq1JwXSIrcz1JY3dJnDsfLpmJcdFtg7wSmZW9tnG96xA_5sQQ0-0X2lXT_XKJrMytiRTfgciQ1e0nUSvpnCfYvK9diuAdWDn1g4zZEmx7JZrXXuM5jYih69LvlJ-2Ifp2ltakI8PzmveXAAAA__9yJ7T_">