kadircet wrote:

I am afraid this doesn't address clangd/clangd#1104 to a useful extent :/.

Whenever a header `foo.h` changes, clangd will schedule indexing of only a 
**single** translation unit that depends on it, not all of them. So if there 
are other TUs that reference `foo`, they'll still stay stale.

This was a deliberate trade-off back in the day, for performance wins, there 
are other cases where files contents can stay the same but USRs for symbols 
inside the file, and the ones being referenced might change (command line 
flags, different PP states, ...) and we assumed they're "rare" enough and will 
be compensated by dynamic index until user modifies these other files.

I guess this assumption didn't age well, I think your idea around having a way 
to flush/rebuild background-index is probably most straight forward approach. 
We didn't have one explicitly, as there's always the workaround of deleting 
`$PROJECT_ROOT/.cache/clangd/index/`. As I believe the performance trade-offs 
here are overwhelming and it'll result in pretty much re-indexing of whole 
project at every rebase or slight modifications to headers (we can't satisfy 
correctness without rebuilding all the TUs that depend on a changed header, 
rather than a single one).

https://github.com/llvm/llvm-project/pull/140651
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to