<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/93335>93335</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] misc-include-cleaner false positives
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy,
false-positive
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
carlosgalvezp
</td>
</tr>
</table>
<pre>
Take the following example code that implements the `log2` function with a custom implementation:
```cpp
#include <cstdint>
constexpr uint32_t log2()
{
uint32_t output = 0;
return output;
}
```
clang-tidy trunk gives:
```
[<source>:3:20: warning: no header providing "log2" is directly included [misc-include-cleaner]]
1 | #include <cstdint>
2 |
3 | constexpr uint32_t log2()
| ^
[<source>:5:14: warning: no header providing "output" is directly included [misc-include-cleaner]]
5 | uint32_t output = 0;
| ^
2 warnings generated.
```
Which seems incorrect. Repro: https://godbolt.org/z/vWoejee9v
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVMGO4ygQ_ZrypZTIAWPHBx_SnckHrFaa44pA2WYGgwXYPT1fv7LjTnpHO62WBiEbqFfFe1UlZIymc0QNiCcQ50xOqfehUTJYHztpZ_o5ZlevX5u_5XfC1BO23lr_YlyH9EMOoyVUXi8mmdAs-4FciisUytz6jkGZYzs5lYx3-GJSjxLVFJMfHg5yMQI_QX6G_O1b5repxnE7Ydw4ZSdNCPxZxaSNS8C_vPdS3sVEP8aAk3GJs38SriTYEVi9Aaun2wIRHyg_pXFKCPyMOfB3iEBpCm6z3y1QnX-h-R8WVrpul4x-xRQm9x07M1P8ncBtK56AP0c_BUWLKH7iwE8sB37CFxmccd2ydB57kpoCjsHPRi-lAMZuIhmaiNoEUsm-4pYsjSCeBhPVbjvYKUvSUQBxXuZd6QGhesaPs4zsBro78XX_ibTjOlZn8eV3kgXw06H4nOStIn8oWqyUPtEKb7D7uMtgb2QjduQoyER6_0F3fO2N6jESDXGh68NCfY9_0Rj8ordPaVybhV2AXTqvr96mvQ8dsMtPYJf5q6dvRPWc6Ybrmtcyo-ZQHUpRHctjnfVNVdZHXRVlfTjkxYFzIY5FWbUtaZW3pKrMNCxnRS5YcahZUdT76ijaWuXXa6l5W-gKipwGaeze2nlY7s5MjBM1NedcZFZeycb12WDs0ezAGLBnYKyVNtJu9NEkM9NyLM5ZaJZYu-vURShya2KKj-jJJLu-Q--iiTP-XwVxjY5v0WM2Bdv8kjOT-um6V34Adlnu2H67MfhvpBKwyyonArvcFM0N-zcAAP__KCmE8Q">