A Clang-based tool that analyzes #include directives in C/C++ source files to ensure proper header dependencies.
Include What You Use (IWYU) is a Clang-based static analysis tool for C and C++ that analyzes `#include` directives in source files. It identifies unnecessary header inclusions and suggests missing ones to ensure each file includes exactly what it needs. This helps reduce compilation times, minimize coupling, and improve code maintainability.
C and C++ developers working on large codebases where build times and clean header dependencies are critical, particularly those using Clang-based toolchains.
Developers choose IWYU because it provides automated, compiler-accurate analysis of header dependencies, integrates with common build systems, and offers automated fixing tools to enforce clean include practices without manual effort.
A tool for use with clang to analyze #includes in C and C++ source files
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Leverages Clang's AST to accurately determine which headers are necessary based on actual symbol usage, minimizing false positives and ensuring clean dependencies.
Includes fix_includes.py script to automatically update #include directives based on analysis, saving significant manual effort in maintaining header hygiene.
Works with CMake, Make, and compilation databases via iwyu_tool.py, offering flexible integration into existing workflows and CI/CD pipelines.
Supports IWYU pragmas for overriding recommendations, allowing developers to handle edge cases and custom include behaviors without breaking the tool.
Explicitly labeled as 'experimental software' with known bugs and gaps, making it risky for critical production use where reliability is essential.
Requires careful Clang version matching via specific branches and managing resource directories, a process documented as lengthy and error-prone.
Heavily reliant on Clang internals, so it cannot function with other compilers like pure GCC, limiting its applicability in mixed-toolchain environments.