[PATCH] D95046: [clangd] Add option to use dirty file contents when building preambles.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 17 02:41:15 PST 2022

sammccall added a comment.

In D95046#3247844 <https://reviews.llvm.org/D95046#3247844>, @njames93 wrote:

> In D95046#3247793 <https://reviews.llvm.org/D95046#3247793>, @sammccall wrote:
>> Sorry about letting this sit. I think this is good to go, with a naming tweak.
>> For the 14 cycle, it should be hidden: we may want to tweak the interactions with `didSave` reparsing etc, and there may be other unexpected wrinkles.
>> Regarding moving to config: we should do this, but there's some dumb bikeshedding of names (mostly: does this go at the top level or do we want a `Parsing` block or something, will other things fit in there, etc). So a hidden flag seems like the easiest thing for now.
> I've been using this locally for months. The one nit i have is if you edit a header file then switch to a different file, diagnostics aren't updated until you force clangd to reparse the file (by editing it for example).

That's the only real interaction I can think of too.
The didSave trigger for rebuild will still trigger the rebuild too I think. It doesn't make a great deal of sense in this mode, but it may still be a helpful workflow.

> However I'm not sure of a nice way around this that doesn't involve trying to rebuild the world when you make an edit to a header.

Agree, this is tricky.

Maybe one idea is a large global debounce: we reparse all files when a header is saved *or* e.g. 30 seconds have passed with no edits to any file.

Exact details could vary, I think important aspects are: rebuilds should not scale with rate of edits, prefer the extra work to happen when relatively idle, clangd should still eventually reach a steady state where it's doing no work until it receives requests.

In any case I'd prefer to land in its current simple form, and land any further bits after the branch cut (soon).

Comment at: clang-tools-extra/clangd/tool/ClangdMain.cpp:506
+                          desc("Use files open in the editor when building "
+                               "preambles instead of reading from the disk"),
+                          Hidden,
Nit: when parsing headers

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list