jansvoboda11 wrote:

> Once a file has been `#import`'ed, it gets stamped as if it was `#pragma 
> once` and will not be re-entered, even on #include.

Can you explain how this is happening? The only place where 
`HeaderFileInfo::isPragmaOnce` is set to `true` is in 
`HeaderSearch::MarkFileIncludeOnce()`, only called from 
`Preprocessor::HandlePragmaOnce()`, which seems correct.

> The problem arises when a submodule includes a multiple-include header. 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). If another module or the main file #import's 
> the same header, it becomes invisible from then on. If the original submodule 
> is not imported, the include of the header will effectively do nothing and 
> the header will be invisible. The only way to actually get the header's 
> declarations is to somehow figure out which submodule consumed the header, 
> and import that instead. That's basically impossible since it depends on 
> exactly which modules were built in which order.

Could this be also solved by tracking the "already included" state [per 
submodule](https://github.com/llvm/llvm-project/pull/71117)?

https://github.com/llvm/llvm-project/pull/83660
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to