ChuanqiXu9 wrote:

> > The simplest example can't work
> > <img alt="image" width="1896" height="570" 
> > src="https://private-user-images.githubusercontent.com/68680648/571178386-7e6d9dc0-3751-4803-828b-3a219f0b4ccc.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzQ4NTc0ODMsIm5iZiI6MTc3NDg1NzE4MywicGF0aCI6Ii82ODY4MDY0OC81NzExNzgzODYtN2U2ZDlkYzAtMzc1MS00ODAzLTgyOGItM2EyMTlmMGI0Y2NjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAzMzAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMzMwVDA3NTMwM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTg5ZjVkYWM0ZTU0ZTZmMGFhZjdkODJhNGZjZmM1YjJmMmVlZDA1ODUyZWMxNjkxY2YxMzhlMGU1YjU4MzUzNGMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.IT45rVF83EPtGQ2hjETklpZJO3LYdxVVddw0fAiBBFM";>
> > ```
> > [
> >   {
> >     "directory": 
> > "/disk2/workspace.xuchuanqi/llvm-project-for-work/llvm-project-for-work/build/clangd_example",
> >     "file": "m.cppm",
> >     "command": "clang++ -std=c++20 -c m.cppm"
> >   }
> > ]
> > ```
> > > With this patch preamble is empty, in general it doesn't matter can it be 
> > > reused it or not, because all includes are in the file body and not a 
> > > part of preamble.
> > 
> > 
> > The question is, when the included header changes, how can clangd detect 
> > that?
> 
> Oh, now I see the problem.
> 
> * mm doesn't show correct value if we are using hove in m.cppm,
> * but mm shows correct value if we are in a source file which imports m.
> 
> But, as I can say, if I make m.cppm to be
> 
> ```c++
> module;
> export module M;
> #include "header.h"
> export constexpr int mm = vvv;
> ```
> 
> This also doesn't work as you expect. So, I think this is is not a problem of 
> this patch.

No, this is definitely the problem of this patch. The original example works 
well before the patch and not working after the patch. You can't really say an 
invariant of the problem exists too so it is not your problem.

And also the variant you made is actually not by design of C++20 modules. 
Inclusion in module purview will be warned. 

And even besides modules, again, this patch breaks the `CanReuse` functionality 
of preamble. This is why I said we can't do so.

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