Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add IWYU pragmas for recursive includes (e.g. implementation headers) #4125

Open
BenWibking opened this issue Sep 3, 2024 · 0 comments
Open

Comments

@BenWibking
Copy link
Contributor

BenWibking commented Sep 3, 2024

Summary

It would be helpful to add Include What You Use (IWYU) pragmas to indicate whether certain header files should not be included by the user directly. This is most often the case for *_impl.hpp header files that provide implementations for template classes.

This is a problem because many IDEs will auto-include headers incorrectly without these pragmas (also, clangd and other tools will complain about violating include-what-you-use).

The two relevant ones are export and private:

foo.h:

// end of file
#include "foo_impl.h" // IWYU pragma: export

foo_impl.h:

// beginning of file
// IWYU pragma: private; include "foo.h"

Docs: https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/IWYUPragmas.md

Headers affected

These are the headers that could have such pragmas included:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant