[clang] Support '-fmodule-file-home-is-cwd' for C++ header units. (PR #135147)

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 10 03:49:15 PDT 2025


ChuanqiXu9 wrote:

> > BTW, I think `-fmodule-file=` is not a suggested way to introduce BMIs. It will load the BMIs eagerly. And for named modules, we will load them lazily according to their name. For header units, may be we can do something with FID. It matters for cases like:
> > ```
> > #include <...>
> > import xxx;
> > ```
> > 
> > 
> >     
> >       
> >     
> > 
> >       
> >     
> > 
> >     
> >   
> > With `-fmodule-file=<BMI>`, we will load the BMI first and include the file. But with `-fmodule=<module-name>=<BMI>`, we will include the file first and load the BMI. It will cause different compilation passes. Introduce unnecessary inconsistency, which will be a burden to both developers and users. So I will suggest to load lazily always.
> 
> Yeah, we do actually use `-fmodule-file=<name>=<pcm>` downstream to do the lazily loading. Thank you for the information anyway 🙂

If you did `-fmodule-file=<name>=<pcm>` for header units, I think it is better to upstream that first. I think it is more fundamental.

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


More information about the cfe-commits mailing list