ziqingluo-90 wrote:

> I'm very happy that this is going somewhere! Everything makes sense to me but 
> I also don't know a lot about this stuff.
> 
> > During serialization, it only serializes regions of the current translation 
> > unit. Regions from loaded files are not serialized.
> 
> Hmm how does this work? When a precompiled header includes another 
> precompiled header, do they both get loaded independently and then you get to 
> combine the maps?

For loading multiple PCHs, it is a chain.  Suppose `TU` includes pch `B` and 
`B` includes pch `C`.   So one would compile and emit PCHs starting from `C`, 
then do it for `B` with `C` being loaded.  When compile `A`, it includes pch 
`B` from the command line and clang actually loads `C` and `B` separately.

It is the same story for modules, except that modules form a DAG instead of a 
chain.   Clang will load each module file in an order with respect to the DAG.  
 So for each module/PCH emitted by clang,  only their own opt-out regions need 
to be serialized.

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

Reply via email to