Skip to content

Include What You Use #8357

@vkucera

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions