Skip to content

Automated determination of #include's #2579

@Lestropie

Description

@Lestropie

I think this had been discussed at some point in the past, but isn't explicitly listed on here.

When adding new code files / augmenting existing code files / moving code between .h and .cpp, it can be difficult to get the #include directives correct. Typically one adds enough to get compilation working, but sometimes it relies on second-order identification of dependencies (ie. a #include within one of the #include'd files). What would be nice is an automated system that applies a similar interpretation to the compiler, identifying the minimal set of #include's necessary for compilation / recognition of dependencies, that would additionally be executed and compared for differences as part of CI.

Previously when I looked into this I didn't find a solution I thought was adequate. But yesterday I came across Include What You Use, and it looks like it could work. It can provide explicit justifications for each #include, it can replace such with forward declarations in .h files where possible, and it can edit files in-place.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions