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

    <tr>
        <th>Summary</th>
        <td>
            Unused lambda capture source ranges are slightly off
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            good first issue,
            clang:frontend,
            quality-of-implementation,
            clang:diagnostics
      </td>
    </tr>

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

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

<pre>
    See: https://godbolt.org/z/MKjzsYb9b

```c++
int main() {

    int a = 0, b = 0;

    auto F = [&a, &b]() {

 };
}
```
The output is:
```console
<source>:7:16: warning: lambda capture 'a' is not used [-Wunused-lambda-capture]
    7 |     auto F = [&a, &b]() {
      |               ~^~
<source>:7:20: warning: lambda capture 'b' is not used [-Wunused-lambda-capture]
    7 |     auto F = [&a, &b]() {
      |                 ~~~^
<source>:7:10: warning: unused variable 'F' [-Wunused-variable]
    7 |     auto F = [&a, &b]() {
      |          ^
```

1) The source range for `&a` includes the comma after it
2) The source range for `&b` includes both the comma and the whitespace between that and the capture

The second point is especially fun when inserting some useless whitespace:
```c++
    auto F = [&a,         
    
     &b]() {

    };
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMVU-PqzYQ_zTDZZQVDBDgwCG7eVyqntqq6tGGAfxk7BSbXe077GevTPKybF7TVQ-VGiFie_79fjPjQTinBsNcQ_4I-TESix_tXHspuON5jqTtXutfmCE94Oj9yUF6AGqAmsF20mr_YOcBqPkG1Pz809dv7g9ZSYiPEB8u7318flqgx_Csp8p4nIQyQCVQhVA8bm0QEYOGQEiPGAM9obws0x8UxeItNqs4cKC9CPpAewn58Y5_KI7vnorjDdLz9teR0S7-tHhUK-sbOtY4q_lymj45u8wtQ_oF0kMB6SHZh5S9iNkoM4SlFpPsBLbi5JeZEagQQAUqh8Z6XBx3Af_u98WE9e6svruoBypXxgVC8YT_mvtqcTV9_71B_uXtLg-KP-Uh_x88EN_eApf7JbmlcoaIz2JWQuqVSxO4bPF_F_5HyN_xfuy-8zsJ5qERz1RwFmZg7O2MQTEE28eoTKuXjh36kbG10yRQ9J5nVP7shT7xIj94kdaPW1emW3cvo_LsTqJllOxfmA36Ufir_HuBN-jXkNxa0-HJhvusHLI7cauE1q_YLwZfRjaojOPZKzOgsxOHFtLs3Cbi39y-7TC5X4drlq96m0L884hYC7WZEh_LE3V12lVpJSKuk4KyssiKpIrGOm-LlAqu2nwv4rYoi0xKWfa9SGPKuiqJVE0xZXFJZVLlSV49dKVM8q6iOI_LoiQBWcyTUPpB6-cpTNdIObdwncT7LMsjLSRrt45rosHaDns1u5BbtzAQAT0BUavF2uL9bI1n010Ffy5CK_-6s_1OTSfNExsvvLLmB9NOicFY51Xrgiw_RnMdIO3kMjjIYq2cd-8gvfKa69_ON-pmRmz7zqEIJ1oNo9evaPs-WmZd33xblB8X-dDaCagJIS5_u9Nsv3LrgZqVrwNqLnl5rumvAAAA___0K-WX">