[clang] [lld] [llvm] [mlir] [NFC][IWYU] Update Support library with IWYU. (PR #102707)

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 12 13:44:22 PDT 2024


dwblaikie wrote:

> > The motivation is as usual IWYU and similar refactoring - to reduce build time and probablility of non-related source(s) recompile.
> 
> I'm confused: as far as I know IWYU achieves the opposite of what you're describing actually: it adds more includes than strictly necessary. (IIUC, the motivation for IWYU is rather correctness and robustness to refactoring and changes).

It can do both - it can remove an unused header, and add a used header that might be indirectly depended on. (& can switch an include to a forward declaration - or the opposite (if a forward declaration is used, but a definition is required and is currently provided indirectly through some other #include))

> > Yes, but I actually do not see what part of the mentioned standard' section conflicts with the change. Would you please suggest an example where we see a situation when applied IWYU approach can contradict with the part of Coding Standards?
> 
> I haven't sanity checked your patch: IWYU is just known to historically to the opposite of what we're trying to do in LLVM (as in: "include strictly the minimum and rely on forward declarations"), either the tools was updated to support the LLVM style, or you've been doing a lot of manual work (but then the PR title is misleading).

FWIW, IWYU does do forward declarations ( https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/WhyIWYU.md#why-forward-declare )

https://github.com/llvm/llvm-project/pull/102707


More information about the cfe-commits mailing list