This is a temporary hack to disable diagnostics for system headers. As of right
now, IncludeCleaner does not handle the Standard Library correctly and will
report most system headers as unused because very few symbols are defined in
top-level system headers. This will eventually be fixed, but for now we are
aiming for the most conservative approach with as little false-positive
warnings as possible. After the initial prototype and core functionality is
polished, I will turn back to handling the Standard Library as it requires
custom logic.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang-tools-extra/clangd/IncludeCleaner.cpp | ||
---|---|---|
294 | As discussed offline, I'm not sure this difference in behavior is as temporary or as narrow as we originally planned. I think the reason we want this hack is:
But this is complicated by the fact that non-stdlib headers can be umbrella headers, system headers are likely to be umbrella headers even if not stdlib, stdlib needs different special handling from other umbrella headers, there are other headers (non-self-contained) that need special handling, etc. Among other things, it's going to be hard to just turn this back on. For now, I'd suggest extracting a function mayConsiderUnused(const Inclusion&) with the simple logic you have here for now, but we should come up with a more concrete plan soon. |
As discussed offline, I'm not sure this difference in behavior is as temporary or as narrow as we originally planned.
I think the reason we want this hack is:
But this is complicated by the fact that non-stdlib headers can be umbrella headers, system headers are likely to be umbrella headers even if not stdlib, stdlib needs different special handling from other umbrella headers, there are other headers (non-self-contained) that need special handling, etc.
Among other things, it's going to be hard to just turn this back on.
For now, I'd suggest extracting a function mayConsiderUnused(const Inclusion&) with the simple logic you have here for now, but we should come up with a more concrete plan soon.