I would like to use the misc-include-cleaner check from clang-tidy in my codebase, but unfortunately, the <windows.h> header used throughout WinAPI conflicts with IWYU philosophy.
Technically, I can include only the necessary WinAPI headers explicitly, but the order of includes is important, and managing it seems tedious.
Is there an elegant solution to this? It feels wrong to disable this check for the entire project just because of this. I'm aware of the IgnoreHeaders option, but I can't figure out if it solves the issue or how to apply it properly. For compiler warnings, I use /external:anglebrackets along with /external:W0, which works great. Is there something similar I can use in this situation?
<windows.h>includes, it's still all going to be transitive includes from the perspective ofmisc-include-cleanercheck.WIN32_LEAN_AND_MEANand the individualNOxyzpreprocessor macros are the only supported way to control the transitive includes of <Windows.h>. If the documentation instructs you to#include <Windows.h>, you are best advised to do just that. The alternative would be to try to untangle the mess of interdependencies that evolved over the course of four decades. Assuming limited developer resources, those are likely better spent elsewhere.IgnoreHeadersdid or didn't work - I'm looking at something similar (not windows) but can't getIgnoreHeadersto work. Hence finding this issue.