4 ms·
iwyu is Google's project originally. It has worked for them for more than a decade on their ginormous monorepo. Sometimes it gets some things wrong, so you hav
by quantumofalpha 5y ago
iwyu is Google's project originally. It has worked for them for more than a decade on their ginormous monorepo.
Sometimes it gets some things wrong, so you have these escape hatches to control it: https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/IWYUPragmas.md https://github.com/include-what-you-use/include-what-you-use...
- cperciva 5y agoEven with a monorepo this isn't necessarily safe -- if you have a mix of x86 and arm servers, you'll need different headers included for intrinsics for example.
- quantumofalpha 5y agoConditionally-off blocks of code under #ifdefs are challenging for it, yes - it runs a proper C++ compiler on your code and won't get to see code in those blocks without the right defines. Don't blindly apply its suggestions - test them, skim to see what it got wrong, sprinkle some "// IWYU pragma: keep" to help it out in corner cases. The tool is more like a linter, you don't follow everything that your linter tells you to, no?
- kccqzy 5y agoThe fix then is simple: run IWYU twice, the first time targeting x86 and then targeting arm. Then you merge the results of these two runs. For conflicts, just don't remove anything. FWIW: when I run this tool my experience tends to be that it adds more includes than it removes, because I guess I rely too much on transitive includes.