ian-twilightcoder wrote:

> The end result should be that #imported and #pragma once-guarded files are 
> treated the same way as #ifndef-guarded files.

While I don't necessarily disagree with that goal in principle, it wasn't true 
before this change either. There was already some special casing to defeat 
`#import`. This change just adds another special case to the `#import` path. 
`#include` doesn't even go through the modified code that is 
`MaybeReenterImportedFile` (née `TryEnterImported`).

> I know you weren't trying to fix that -- but I'm saying that's the thing that 
> _should_ be fixed, and that doing so would fix the _serious_ part of the 
> problem you described in the initial message.

Modular headers including non-modular headers is a special problem. If we let 
every module enter the non-modular header (which Jan's patch does), its 
declarations will build into multiple modules/pcm files, where they will 1) 
conflict and cause errors in the several cases where type merging can't handle 
them, and 2) come from multiple modules which is undefined behavior for Swift 
(i.e. Swift will see `mod1.type` and `mod2.type` and won't know how to resolve 
un-qualified `type` in code). So I don't think that case really _can_ be fixed.

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