[PATCH] D54077: [clangd] Implemented DraftFileSystem

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 6 09:25:42 PST 2018

sammccall added a comment.

In https://reviews.llvm.org/D54077#1288455, @LutsenkoDanil wrote:

> I already made a patch which introduces such behavior (not uploaded here yet), and looks like it works well with draft fs: diagnostics updates for depended files in 'real-time' on typing for opened files and no seen performance glitches, in multi-threaded mode at least.

This does indeed sound exciting! I'm a little skeptical that it "just works", there are some tricky cases:

- TUs where the preamble takes multiple seconds to rebuild
- "thundering herd" problems if several TUs are active that include the edited file
- redundant background work does have costs (e.g. battery)

> If it helps (and the LSP allows it): In case A.h is edited, we flag it dirty. If the user makes some file depending on it visible (or the current file), we trigger a reparse for that. Not sure whether the LSP has a notion of current or visible files...

It doesn't. Maybe there's a way to make this idea work anyway (nothing comes to mind).

> I suggest continue discussion when/if dependencies tracking will be implemented and real performance reduce introduced by this patch can be checked with real code.

Sounds reasonable. I think maybe the shortest path there is to implement on top of the LSP file change notifications, and have it push a "maybe rebuild" item on every TUScheduler worker.

  rCTE Clang Tools Extra


More information about the cfe-commits mailing list