We have regular issues with missing includes. These are minor, and easily resolved when they come up, but can be a significant user frustration when they occur in our public headers.
It should be possible to add automated checks for this, along with the existing formatters/linters we already have. Include-what-you-use looks like a promising option. It has a strict concept of required includes (no transitive includes, even for .cpp!), but I think that's standard and fine. It can even add comments explaining why each header is present.
I've experimented with this locally, and it has some problems with our funky toolchains, and a fun deeper issue error that's probably from a clang version mismatch (Error running 'iwyu': /build/iwyu-QrxlvO/iwyu-8.0/iwyu.cc:3353: Assertion failed: llvm::isa<clang::TemplateDecl>(named_decl)TemplateSpecializationType has no decl of type TemplateDecl?). This also makes a huge number of changes (git diff | wc -l = 1071), so will require a big-fix initial commit.
We have regular issues with missing includes. These are minor, and easily resolved when they come up, but can be a significant user frustration when they occur in our public headers.
It should be possible to add automated checks for this, along with the existing formatters/linters we already have. Include-what-you-use looks like a promising option. It has a strict concept of required includes (no transitive includes, even for .cpp!), but I think that's standard and fine. It can even add comments explaining why each header is present.
I've experimented with this locally, and it has some problems with our funky toolchains, and a fun deeper issue error that's probably from a clang version mismatch (
Error running 'iwyu': /build/iwyu-QrxlvO/iwyu-8.0/iwyu.cc:3353: Assertion failed: llvm::isa<clang::TemplateDecl>(named_decl)TemplateSpecializationType has no decl of type TemplateDecl?). This also makes a huge number of changes (git diff | wc -l = 1071), so will require a big-fix initial commit.