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. > > Tried this example, and it works ok for me. > > Maybe you can just check this patch to make sure?
I just tried and it doesn't work. And also it is weird that it works as it literally violates the abstraction of `canReuse()` feature. If clangd is able to detect change, why do we have `canReuse()` ? > > > 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) I failed to understand what you want to say. If we change the file by adding a new #include, of course, it should change. But I guess you're talking about something different? https://github.com/llvm/llvm-project/pull/189284 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
