[flang-commits] [flang] [flang][NFC] Remove unnecessary #include directives across flang (PR #207640)

Oliver Stöneberg via flang-commits flang-commits at lists.llvm.org
Wed Jul 8 00:13:10 PDT 2026


firewave wrote:

> Audit of every #include directive in flang/lib/ and flang/include/flang/:

> each removal was tested by recompiling the translation unit (or a standalone TU containing only the header, preserving self-containedness) without precompiled headers before and after, per file as a unit;

This only proves that it compiles but but not that they are actually "unnecessary". The improved compile time shows that lots of them are unnecessary but this most likely also greatly increased the reliance on transitive/drive-by includes. Depending on the platform and the usage of the headers involved this might cause unnecessary breakage for users. And as compilers reduce the reliance on transitives includes in their headers this might also cause breakage with future versions. This will lead to band-aid fixes starting to adding back includes which have been removed in this PR.

This approach of checking includes is very outdated and it should have been tool-driven by either `clang-include-cleaner` and/or `include-what-you-use`.


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


More information about the flang-commits mailing list