[clang-tools-extra] [wip][clangd] Introduce --skip-preamble-build command line option (PR #189284)
Chuanqi Xu via cfe-commits
cfe-commits at lists.llvm.org
Sun Mar 29 23:18:28 PDT 2026
ChuanqiXu9 wrote:
> > But in the current impl, for module units containing headers, how can clangd detect the change in the included header for the module units?
>
> I checked, for me this scenario works correctly. I used example provided here #181770:
>
> * modifications of exported structure (added field)
> * add an include at the end of M.cppm
>
No, the example in my mind is,
```C++
// header.h
#pragma once
constexpr int vvv = 43;
```
```C++
module;
#include "header.h"
export module m;
export constexpr int mm = vvv;
```
We should be able to see the mm's value as 43. And after we change the value to 44 or 45 in header.h, we should be able to see mm's value be the corresponding value.
> Behavior should be the same as for includes, which are outside the preamble section (e.g. include directive in the middle of the file), so I believe everything should be ok.
No, modules have different mechanism. We can't assume header will have similar affect. But after all, the mechanism comes from the `canReuse` interface from the preamble. And now you just simply not building the preamble, I believe the `canReuse` interface will stop working and clangd won't detect the changes.
https://github.com/llvm/llvm-project/pull/189284
More information about the cfe-commits
mailing list