<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/57344>57344</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] Add a check to find unused variables after copy
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Febbe
</td>
</tr>
</table>
<pre>
clang-tidy does not warn, when a large movable object is copied instead of moved, and when the object is itself unused after the copy.
For example:
```
MyObj::fun(std::vector<size_t> large_list){
this->large_list = large_list;
// ^_______ expecting "object can be moved" here
}
// ^_______ expecting "object unused before destruction" here
```
It would be useful to add a check, which searches for those objects to increase performance.
I propose `performance-unused-objects`
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyFUsFu2zAM_Rr5QiSwZcepDz6kTQv0MOwTCsmibXWKZEhyuuzrR8XO0g4DJgiyKT4-PpGUTl3azgg7bKJWF1AOA1gX4UN4y_gTfIxoQYARfkA4ubOQBsHJd-wi6ACdmzQq0DZEFApcnzCoUqSwaomO4-cIHQOaHmY7BwoUfUR_RRDTZcvyI8sPy_niPOBPcZoMsvIAq6vO1301v12-y3fy0u5n0vsQolrMM6VznpVPQf_Ct8jK5-UNb0aHyHjD9o8LBdCKow4bgtwRwMrj54ByRTP-Qhv-tdju-W1ZJHui9NoOwDhfn94JCxJv5eEwoseVc3_8Qv4forVyEnvnERSG6GfCOPsX69dKLecrNdbNJkUDsfSzgehAKGoEdCN2P5aW626EgMLTVQBKQwVy4dbEkEK07TwKupvQE-AkbIdr915h8m5KeEr-yb1ZhG9Wlj_KMmyLui7K3b7Z55lqS9WUjciijgZbtnu8TyfbHeFw15p09JqmbK3IWXidxjOsU5UmKpu9accYp5DG4lrfQcdxltvOncgw5nz7bEh2UkamDmHGQD-7fVlV2djWhagKVchKNkrUijeyUk3dN1I88F2R15kREk1Icklkpluec54_8Kqoi6bMt1LwfdEjFl2VdwVWrMrxJLTZpsRb54fMt1cNch4COdPMhbtThKAHi3jjFzM1xLcvKCVmV7HtVelvTzs1KA">