[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 01:28:08 PST 2022


sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.

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.



================
Comment at: clang-tools-extra/clangd/ClangdServer.h:169
+    /// If true, use the dirty buffer contents when building Preambles.
+    bool UseDirtyPreambles = false;
 
----------------
Naming (here and throughout). On reflection the use of "preamble" isn't ideal:

 - it mostly affects the preamble, but not exclusively: `#includes` in the non-preamble region also use this FS.
 - it's jargony, and if we want to put this in config we should use a friendlier name. Might as well find one now.

I'd suggest a boolean `UseDirtyHeaders` for now, and if we move it to config then something like `HeaderContents: Saved|Dirty`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95046



More information about the cfe-commits mailing list