ArcsinX 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.

Tried this example, and it works ok for me.

Maybe you can just check this patch to make sure?

> 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.

I mean that without this patch we can add `#include header.h` in the middle of 
the file and I believe this should be ok, If not, we need to investigate this 
(but for me it works)

https://github.com/llvm/llvm-project/pull/189284
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to