sammccall added a comment.

To give a bit of context here: the end-goal here is hot-reload of 
compile_commands.json. (This covers our *two* top bugs: #192 and #83).

I'm very happy with the hot-reloading of config files (.clangd etc) and I think 
it's a good fit to generalize.
In particular, config parsing shouldn't be repeated unneccesarily as it has 
side-effects (diagnostics). Similarly, compile_commands parsing shouldn't be 
repeated as it's expensive (the file is often huge).
So this is better than other approaches like caching at the FS level.

We could reasonably apply this to .clang-format and .clang-tidy as well. 
Currently we stat up the directory chain, and then read and parse these every 
time. It's not very expensive as these are small files, but it's also not free.

In all of these cases, the costs are going to be in eschewing the simple APIs 
that hide all the IO. For compile_commands.json, we need to extend or stop 
using the generic compilation-database plugin mechanism. For clang-tidy/format 
we need to introduce a tree-shaped cache (we have one for CDBs already).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88172/new/

https://reviews.llvm.org/D88172

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to