<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/70665>70665</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
`clang-include-cleaner` does not consider `std::swap()` specializations
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
firewave
</td>
</tr>
</table>
<pre>
```cpp
#include <string>
void str()
{
std::string s, s1;
std::swap(s1, s);
}
```
The `clang-include-cleaner` standalone application suggests to add `<utility>` although `<string>` is enough.
clang-tidy output:
```
<source>:6:10: warning: no header providing "std::swap" is directly included [misc-include-cleaner]
2 |
3 | void str()
4 | {
5 | std::string s, s1;
6 | std::swap(s1, s);
| ^
```
https://godbolt.org/z/Pczfsfdqo
Reference:
https://en.cppreference.com/w/cpp/algorithm/swap
https://en.cppreference.com/w/cpp/container/string/swap2
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVMGO4yoQ_Jr2BSXCENvJwQdPMj4_Pe0PEGjbrAh4ASfKfP0K26NEs9FqtFIUA90URVU3IgTdW8QaijcoTpmY4uB83WmPN3HF7OzUvYaSLj85jkBPQBtgXFtpJoUE-DFEr20P_H0Nzv9XpxUJ0QPbAzuskeptGRBCSIgKeAO8WbaTAOxIQg78Zc5NjMD2IZ-TEuBnGlSndfDJ8pnFjwFJIm6E7Tcr5Y00KCx6KCkJUVgljLNIxDgaLUXUzpIw9T2GGEh0RCiVIIAfp6iNjvd00ZISYeLgpn5Ygw8RSkp0IGhTcPtMZmERtboTN8VxiuluL7nzY3CTl5jgeFMCb3IKvCE34e18SkOsIwMKhZ6M3l21ShICY18UY4mK0h5lNHeyCqAIFG8XHeQfihSnh_aMQHUkjzmf569sTdHdkv1scDEvfdfqcs7-huEz4nJa8f5SviHGMSQY1gJre6fOzsSt8z2w9gNY-5_86EKnfrlnc_7HDj3apHnzCgbtVo6j_8zaSncB1t6AtakrWCtM77yOQ1qdyf8DhnQ2Cp2MYO1aTwsYy1TN1YEfRIZ1Xh72ZVWVNM-GmnVFuT8rdcBCHKQQe4Wy6Ni-qg6CUkkzXTPKeE45zXcFZ_m2K3ZVp_IyP9Oq21MOO4oXoc3WmOslqZTpECasK1qWRWbEGU2YnwfGLN7IHATG0mvh67Rnc576ADtqdIjhgRJ1NFj_rfmUw0Csi0Q6G3QqZSjp1wpI1qdGHVFqYfTH3KAhm7ypv_is4zCdV00Ti_WzGb37iTICa2fuAVg73-13AAAA__921HcC">