Issue 98122
Summary clang-tidy misc-include-cleaner does not detect `chrono` header
Labels clang-tidy
Assignees
Reporter andrea-cassioli-maersk
    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.
```

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to