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

    <tr>
        <th>Summary</th>
        <td>
            clang-format incorrectly formats C++ lambdas with BeforeLambdaBody true
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    Based on #51234 this issue is about the incorrect formatting of C++ lambdas with BeforeLambdaBody true. Content of .clang-format:
```
BreakBeforeBraces: Custom
BraceWrapping: {
    BeforeLambdaBody: true,
}
ColumnLimit: 0
```

The problem has been described by @kalinnikovv:
The closing brace of the lambda body always gets folded into the line before it.
```
foo(param, [] {
return 1;
}());
````
gets formatted into
```
foo(param, []
    {
         return 1;  });
```
while I expect it to become
```
foo(param, []
    {
         return 1;
    });
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytU8uumzAQ_RqzGV3kGAiXBYtLokqV7rJS1zY44MbYyDZJ8_cdQ16tsmilWiPwPDxz5ngsbHepG-5lB9YAYVmxYVkOYVAelPezxC9wYeeANlRMa52TbYCDdSMPQZke7AF2hDUooPkoOu7hrMIAjcQg-bmYGqwDwc0yhZ01QZoQj6Wt5qZ_W3OR7IPQPaEfZEuvsqiNk_y45mocb6XHQNjNPtjxFoDW745PE6KJTlI2qwdw_YkiBkQghO2u5cr9utlZPY_mU40qYgH6Es36_YZcTM4KLUcYsF8hpYFO-tYpgVSKC5CcHrlWxqijPZ3uvcWDrbY-8iYi7khDZHZlDkTkieszv3joZfDIs-4wozLBrnHKSCwXewIV0pcYD9YS9j5xx0fsEkjRkGL_YMXJMDsDG5I1DwbYO2FVlLvxnvOW9opnufcrpL8v_7iQ325nWU-Aonv_GsaingelJXwF-XOKU6hwLC3S0dpR_ncsz2GvMSVdnXVVVvEkqKBl_TzOj7eiL1fW_D-8k2R2uh5CmOK4E_YFpcfgWaTYKypan26_N5zEH1gH1eXJetwUebF5T4a63LQlp4WgvBBVta1oXrJqe8houckFZSLRXEjt60gMY0ae11ePe-QpUTWjjNGM5bRgRVamBWVV2xXFFrWDyBhOuRy50mnEkVrXJ65eIIm59-jUygf_cHLvVW-krNd7SPgcBuvqYKfB2mSpXC_IfwHJslpP">