[clang] [clang][modules] Headers meant to be included multiple times can be completely invisible in clang module builds (PR #83660)

Volodymyr Sapsai via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 11 16:47:06 PDT 2024


vsapsai wrote:

To clarify a little bit
> [...] The "already included" state is global across all modules (which is necessary so that non-modular headers don't get compiled into multiple translation units and cause redeclaration errors).

The necessity isn't actually true. The same definition in multiple modules shouldn't confuse clang as long as these definitions are identical. But this is a side issue.

To re-iterate what this change is about:
1. `#import` implies a file is a single-include
2. Textual header in a module map implies a file is a multi-include (aka re-entrant)
3. When we have both `#import` and the header marked as textual, `#import` "wins", i.e. the file is single-include
4. You want to make that when we have both `#import` and a textual header, textual should "win", i.e. the file should be multi-include

Is it correct?

https://github.com/llvm/llvm-project/pull/83660


More information about the cfe-commits mailing list