<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/98122>98122</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-tidy misc-include-cleaner does not detect `chrono` header
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
andrea-cassioli-maersk
</td>
</tr>
</table>
<pre>
I have noticed that when running with `misc-include-cleaner` option, clang-tidy seems not to detect that the `chrono` header is provided and used.
In one of my project file you can find
```
#include <algorithm>
#include <chrono>
#include <functional>
#include <set>
#include <string>
// some other code
const auto time_residual = rotation_time - std::chrono::round<std::chrono::weeks>(t);
constexpr std::chrono::minutes kThreshold{30};
if (std::chrono::abs(time_residual) > kThreshold) {
results << ErrorMessage("FOO");
}
// and more code goes here
```
Running clang-tidy I get
```
/Users/<my-path>/foo.cpp:241:68: error: no header providing "std::chrono::round" is directly included [misc-include-cleaner,-warnings-as-errors]
2 | const auto time_residual = rotation_time - std::chrono::round<std::chrono::weeks>(t);
|
```
and the header `#include <__chrono/duration.h>` is added to the file.
Notice it is not only `std::chrono::round` that is not found, but `std::chrono::weeks` as well.
I am running on
```
➜ $ clang-tidy --version
Homebrew LLVM version 18.1.8
Optimized build.
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEVV1v6jgT_jXmZhRkbCDJRS4oFL2VznkrrXb3tjLxkHjr2Mh2yrK_fjVJ2lIdyu0iZELm-5mZxypG0zjEiq0e2Go3U31qfaiU0wFVVpPYW5N1CkN8nR28vlRP0Ko3BOeTqVFDalWCc4sOQu-ccQ2cTWqBrXlnYp0ZV9teY1ZbVA4DW3Pwp2S8Y2ILtVWuyZLRF4iIXSSnkDxoTFin0XVqkZzVbfDOk3mLSmMAE-EU_JvRqEE5DX1EPWd8x_hmPJ8ceIfgj9BdSPUvcnk0FuHie6iVg6Nx-tqCrfn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