Description
According to the documentation for clang-include-cleaner at https://clangd.llvm.org/design/include-cleaner#iwyu-pragmas, the IWYU pragma no_include
is not supported (and I see it not having an effect in my IDE).
Plenty of libraries are designed for the user to include a single header file, not any of the private implementation files, but don't have any IWYU pragmas to indicate this to clang-tidy. And let's be honest, it'll be a long time before all software is making good use of IWYU pragmas.
As a user of these libraries, we can either turn off the misc-include-cleaner test in clang-tidy, or try to ignore the warnings in the IDE. Neither is ideal. If the library is open-source, of course, we could also submit a PR to the library in the hopes the owner cares. Currently the only way to suppress the warning is to add // NOLINT(*-include-cleaner)
to each line that uses functionality from this library. This is of course highly impractical.
A simple and practical solution for the user would be to add // IWYU pragma: no_include "library/private/*"
to the source file.