Skip to content

Include What You Use #8357

Open
Open

Description

@vkucera

Include What You Use (no more, no less)

References:

Tools:

Ideas:

  • A file which does not include what it uses does not compile. This can be tested with:
    clang-tidy <file>
    (It should be enough to check for non-zero exit code to detect compilation errors.)
    However, if it compiles, it does not mean that all used headers are included directly nor that no unused headers are included.
  • When the file compiles, the includes in it can be fixed automatically with:
    clang-tidy --fix -checks=-*,misc-include-cleaner <file>
    until there are no warnings left.
  • Once all headers are self-contained, source files can be fixed with the same procedure.

Activity

  1. vkucera commented on Sep 2, 2025

    @vkucera
    CollaboratorAuthor
  2. reopened this on Oct 8, 2025
  3. vkucera commented on Oct 22, 2025

    @vkucera
    CollaboratorAuthor
  4. vkucera commented on Apr 16, 2026

    @vkucera
    CollaboratorAuthor
  5. vkucera commented on Jul 30, 2026

    @vkucera
    CollaboratorAuthor
  6. vkucera commented on Aug 4, 2026

    @vkucera
    CollaboratorAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementhelp wanted

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions