<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/113494>113494</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-include-cleaner] <expected> incorrectly diagnosed as unused when using libc++ because of outdated StdSymbolMap.inc
</td>
</tr>
<tr>
<th>Labels</th>
<td>
libc++
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
vvd170501
</td>
</tr>
</table>
<pre>
### The problem
```cpp
#include <expected>
std::expected<int, char> Foo() {
return 123;
}
```
When using libc++, both clangd and `misc-include-cleaner` check in clang-tidy (trunk versions) diagnose `<expected>` as unused.
Reproducer: https://godbolt.org/z/T4fesGThr
With libstdc++ the usage is detected correctly.
### The cause
In libc++ `std::expected` is actually defined in [__expected/expected.h](https://github.com/llvm/llvm-project/blob/main/libcxx/include/__expected/expected.h#L449).
Correct headers for std symbols are defined in [clang/lib/Tooling/Inclusions/Stdlib/StdSymbolMap.inc](https://github.com/llvm/llvm-project/blob/main/clang/lib/Tooling/Inclusions/Stdlib/StdSymbolMap.inc), which hasn't been updated since 2022-07-30 and currently doesn't contain an entry for `std::expected`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVM2O4zYTfJr2pWGDatqWddBhxl59WODLJTNAjguKbFvM0qRBUt5xnj7Qz854newhSADCP2yS3VXV1Sole_LMNWyeYXNYqD53IdbXqylKsRHFog3mVgPJaeFrx3iJoXV8BnEA8TR_bsW09OUy75C0XrveMILc89uFdWYD8tP9tZQNyCeQTx_xvfUZaI-6UxHkJ2xCANoBVQjl83QLETFy7qPHgiTIeRvKw0Mx96l-69hjn6w_obOtBnoe1x7bkDvUTvmTQeUNwlacbdLLufqldqw8R9gK1B3rr2j9dHyZrbkh0C7H3n_FK8dkg09Dqcaqkw-Jh8ce0G8FqoS97xObFU61_cqXGEyvOYJ8wi7nSxpooQaoOQXTBpdXIZ6Amj-Amtf1kdP_Xrs4A7O5GyClbGZUmDvGPqkTo01oOI_JUYcYWWd3W_2g3A_SatUnvg9_9nd0DXD-KtlWDGmUzr1y7oaGj9azGWiCzfOXL-_nqPn-c9XB5gC0e0Bqc9e3Kx3OQI1z1-9fy0sMv7POQE3rQgvUnJX1Q9C2-u0NqJmlAmp-lo7k_9frCqiase8nLrBjZTgmPIaIKRtMt3MbXEIV-QHIKPmUdNAgBGfH_5-H3LPwzUs2U_wlm5fxqV_UZWW9_k_w_ssSqBra_VtndYedSh6ozNjyYIuLUUOHJOs1IwmipSiXUox-0H2M7POgbOD5lg4-K-tReWSf423k7yfNsVqYWppKVmrBdVFSVRbbXVEtunrb7spWbFmY41HRrtRqe2S9W3PBpIqSFrYmQetCkCSxkbJaccm7UhQbXe6OhZYlrAWflXWrgbfBIgubUs91Uch1tV441bJL42gjunc9DaMu1iPbbX9KsBbOppw-3sk2u3EoTlZ_HAabw8NUQ-vf_fVuf_Nhdfz2d_MHWx4dh-GIoc-TCo_CLfro6n_cOiMRQ0PMXFxr-jMAAP__-OXeOw">