<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/80853>80853</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Create performance-avoid-reserve-in-loop
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy,
check-request
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
PiotrZSL
</td>
</tr>
</table>
<pre>
I'm adding this here so, i wouldn't forget.
Background: https://www.dominikgrabiec.com/c++/2023/10/31/cpp_antipattern_using_reserve_in_loop.html)/c++/2023/10/31/cpp_antipattern_using_reserve_in_loop.html
```
Container container;
for (const auto& entry : entries)
{
container.reserve(container.size() + entry.ItemCount());
entry.AppendItems(container);
}
```
Check should detect calls to reserve in loop on object that is outside of the loop.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysk8-OpDgMxp8mXCJQykABBw71R0gt7WGlve2lFBIXZBsSNjFd6nn6UQp6ulua40gWBPvTD38GyxDMYBFbVp5ZeU3kSqPz7d_Gkf_3n7-S3un39oVBNXOptbEDp9EEPqJHHhyDCzf84dZJWwYV8bvzA1LGxJWJ03Y9S_U6eLdazfITH4mWwPITg45B93g8Mu1mY83r4GVvUGXKzQw6xeD8jA4E5Ay6g2DQ5YdYWpabtGQWSYTe3tZg7HDzGNC_4c3Y2-Tcko00TwyaP4b6YogdxR7Px4uzJI1Fz9XHieXnrXZ3njOolbOBuFzJMThytOTfeRxGPBkMsc-NXJ0_XtT8gmV7PxtnzwXzIyYYNJzBeUNmL4Tzxa2WtkqM_BO4aU7LglZHZfgK_Katrr81utsdUb3yMMZvzjUSKuJKTlPg5PjeKjeWx9FxZ7nr_4sSGiVxE7hbKRiN3N05jfhUZYluc93kjUywPVSigrw4lHUytlAUugRdKHXotQbVH1Eemhrvx6YUZVUlpgUBhQBxPJQF5HUmGlHUdXNHVOWxqoAVAmdppmya3ubM-SExIazY1qIu82SSPU7h-esDqEnaISWj3xkAg0tMRa-px_9XDBSz5TXxbUSl_ToEVojJBAqfcDI0YXvxKAn5gv7u_CytwlS-OaPTfTypsWk0nqx-ar8vxGBoXPt9CSJ2v6WLd3GODLqngcCge3r4GQAA__8Efi6R">