[clang-tools-extra] [clangd] [C++ Modules] Skip PCH when TU imports modules (PR #187432)
Chuanqi Xu via cfe-commits
cfe-commits at lists.llvm.org
Sun Mar 22 19:55:59 PDT 2026
ChuanqiXu9 wrote:
> > No, there are countless reports about clangd crash with modules. And a lot of users don't open issue reports and they just say "clangd supports modules not usable".
>
> Can you please clarify where this happens? Because currently the only issue which you referenced is about diagnostic message.
Here is not a complete list:
https://github.com/llvm/llvm-project/issues/130280
https://github.com/llvm/llvm-project/issues/148370
https://github.com/llvm/llvm-project/issues/80570
https://github.com/clangd/clangd/issues/2536
https://github.com/clangd/clangd/issues/1981
> But in general this happens quite frequently, when someone reports problem in clangd, but really it's a problem inside clang. And here I guess we can reproduce these clangd instability problems with clang, if we create pch files for `#include`'s section manually.
We can do that. But I don't know when will we fix that. Given my experience in serialization, I feel it is a no DDL thing.
>
> > The patch itself in ParsedAST is less than 10 lines. Easy to understand and won't affect users who don't use modules.
> > And finally, I think, we have consensus on code level. And what we have gap is, the experience and feelings for users of modules community and the realility of lacking implementation resources. Although this is slightly strange to say in a code review, but I think you can trust me that I am keeping making things working in limited resources.
>
> Sorry, I think we should follow LLVM Developer Policy here but not resources availability and judjment how easy to implement something or not.
Could you clarify the Policy details?
CC @AaronBallman @HighCommander4
> Modules support feature was already introduced in clangd (by you) and together with this patch we introduce performance degradation in some scenarios (with this feature enabled) and these scenarios had no problems before.
For the current support status of modules in clangd, I think it is not so meaningful to talk about performance for modules user right now. It is basically not working or works rarely. And also the performance loss should be limited. On the one hand, building PCH is relatively fast. On the other hand, in modules uses, the number of #include will be limited.
https://github.com/llvm/llvm-project/pull/187432
More information about the cfe-commits
mailing list