[PATCH] D51725: Allow un-setting the compilation database path

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 13 00:01:48 PDT 2018


ilya-biryukov added a comment.

If this setting exposed directly the users in Theia or is it something that is exposed via a custom UI (e.g. choosing named build configs or something similar)?

In https://reviews.llvm.org/D51725#1232171, @simark wrote:

> I was assuming that restarting clangd might potentially be significantly more costly than just changing a setting, but maybe I'm wrong.


It's only cheaper if changes in the compilation database paths don't affect compile commands. If they do, everything will get rebuilt on next access, which is costly.

> The point of switching compilation database path is usually to point to a different build that has different flags, so all open files will get reparsed anyway...  And just start clangd isn't particularly heavy.

+1, since all compile commands change, we probably never get a performance win in practice.
One thing that (I believe) we're currently doing is using the old preamble for completion. This allow to code complete before reparse of preamble is finished.
I'm not sure this works when changing compile commands, though. Have not seen the breakages yet, but it's also neither something we've been testing nor something that pops up often in practice.

> I'll investigate how difficult it is to make our frontend (Theia <https://github.com/theia-ide/theia>) restart clangd when the user switches compilation database.

If that is feasible, might allow removing some code from clangd. Though don't expect that amount to be too high.
One potential complication to restoring the state of the language server. It should be just the list of open files, but I may be missing something.

If you'll decide to go with an option to reset the path, see the comment about making empty path special. `Optional<Optional<>>` does not play nicely with json serialization code and hard to read (even though it does look like the right thing to do from the type system perspective).


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51725





More information about the cfe-commits mailing list