| Issue |
169667
|
| Summary |
[clang-tidy] misc-include-header fails to report thread header is missing (while clandg correctly report it)
|
| Labels |
clang-tidy
|
| Assignees |
|
| Reporter |
blabdouze
|
`clang-tidy-21` check `misc-include-header` fails to report that `#include <thread>` is missing.
`clangd-21` on the other hand will report him as missing as expected.
Reproduction :
Taken from repository : https://github.com/blabdouze/misc-include-cleaner-not-reported/tree/bug/clangd-missmatch-tidy-include
```cpp
#pragma once
#include <thread>
#include <vector>
class A {
public:
A();
private:
std::vector<int> myVector;
std::thread myThread;
};
```
```cpp
#include "A.hpp"
A::A() {
// Report warning in clangd but not with clang-tidy
myThread = std::thread([] {});
// Reports warning: no header providing "std::vector" is directly included [misc-include-cleaner]
myVector = std::vector<int>();
}
```
clang-tidy-21 output :
```
root@bd29cfc504f4:/workspaces/misc-include-cleaner-not-reported# clang-tidy-21 -p=build A.cpp
109 warnings generated.
/workspaces/misc-include-cleaner-not-reported/A.cpp:7:21: warning: no header providing "std::vector" is directly included [misc-include-cleaner]
2 |
3 | A::A() {
4 | // Report warning in clangd but not with clang-tidy
5 | myThread = std::thread([] {});
6 | // Reports warning: no header providing "std::vector" is directly included [misc-include-cleaner]
7 | myVector = std::vector<int>();
| ^
Suppressed 108 warnings (108 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
```
clangd-21 with this configuration inside VS Code :
```
---
Diagnostics:
MissingIncludes: Strict
UnusedIncludes: Strict
```
<img width="933" height="155" alt="Image" src="" />
<img width="927" height="101" alt="Image" src="" />
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs