Include What You Use – source analysis tool

Include What You Use is a source analysis tool for C and C++ projects built on Clang.

It checks whether each translation unit directly includes the headers needed for the symbols it uses, helping developers identify unnecessary includes, tighten dependencies, and keep source files more self-contained. The project is intended for integration into existing build workflows and also ships helper scripts for project-wide analysis and automated include cleanup.

This is free and open source software.

Key Features

  • Analyzes C and C++ source files to determine which headers should be included for the symbols in use.
  • Helps detect superfluous includes so projects can reduce unnecessary header dependencies.
  • Can be run on individual source files with normal compiler flags.
  • Supports integration with existing build systems by replacing the compiler invocation in batch runs.
  • Works with CMake through the CMAKE_CXX_INCLUDE_WHAT_YOU_USE and CMAKE_C_INCLUDE_WHAT_YOU_USE options.
  • Includes the iwyu_tool.py helper for running analysis across projects that provide compile commands.
  • Ships fix_includes.py to apply recommended include changes automatically.
  • Provides Clang version specific branches and release mappings to match the tool with compatible Clang versions.

Website: github.com/include-what-you-use/include-what-you-use
Support:
Developer: include-what-you-use contributors
License: University of Illinois/NCSA Open Source License

Include What You Use is written in C++. Learn C++ with our recommended free books and free tutorials.


Best Free and Open Source Software Explore our comprehensive directory of recommended free and open source software. Our carefully curated collection spans every major software category.

This directory is part of our ongoing series of informative articles for Linux enthusiasts. It features hundreds of detailed reviews, along with open source alternatives to proprietary solutions from major corporations such as Google, Microsoft, Apple, Adobe, IBM, Cisco, Oracle, and Autodesk.

You’ll also find interesting projects to try, hardware coverage, free programming books and tutorials, and much more.

Discovered a useful open source Linux program that we haven’t covered yet? Let us know by completing this form.
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments