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

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy] readability-identifier-naming removes reference in lambda capture
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          marcin-szmagara
      </td>
    </tr>
</table>

<pre>
    When running `clang-tidy` with `--fix` option on this code:
```C++
int main()
{
  int x;
  auto f = [&]() { x++; };
}
```
with this config:
```
---
Checks: '-*, readability-identifier-naming'

FormatStyle:     file
CheckOptions:
  - { key: readability-identifier-naming.LocalVariablePrefix,   value: 'local_'       }
...
```
it produces following output:
```C++
int main()
{
  int local_x;
  auto local_f = [local_x]() { local_x++; };
}
```
The renamed variable of type `int` is now captured by value, while should be captured by reference.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJylU02PmzAQ_TXmMgKBCRAOHHY32lOlVmrVHitjBnDX2BE2m01_fceQpF1ttVJVZCXz5eHNe0Nru3PzbUQD82KMMgOwMpVamCH2qjuTAyflxxCN4169hIA9emUN0PGjciBthyy_Y-mBpXeU384D4_fhrFFlPExCGcb3jNeXyuqSBAjpF5bffLF4Cz2w_ACsoC4lKw7bVaBbVLq1zu_JPdzuBfs1hs1d8V-Qml4Nb7FubhzHm_EwonxyVAaMVzHjd4w_wIyiE63Syp9j1aHxqlc4x0ZMRBrVXVquv492noT_7M86EAPh6RXZv7t_XCl0NygA8TraE57DjXdflnywUuivYlai1fhpxiALIQR4FnrBC24dir6TAdtzYydJkr-OrzwcZ9stEh30Vmt7CttgF39c_P_Lu8F5I_IWvkl9rXol9zX4T6J_GZFYJMKwI1o2qsD24M9HDMtMmMIq01IYewIpjn6ZqbQ9X0gkPk8jaQZutIumBL4qItKR2ktMImyysszqXbHfpVHX5F2d1yLyymtsaKQ_vqXi8L6wlJ3sM9F_607UgRZT24nr26Nl1s3o_XHdHf5IZ6D9XtpE2okcrZ-vfzHJ-QOlJ1c5t6Ajo6h2VRaNTb2rqrTYV7Kt0k4KxL5L87TGSrRlzwsZadGids36-XGDJ1hbkE1TRKrhKefpPs-yLK94mvS87Lu6L7NM1HkvC7ZLkRZCJwFHYuchmpsVUrsMjpJaOe9-J4VzajC48hX602qMdm4mMUtlYvdzEoOYRbRCaNYRfgHA3WWh">