[PATCH] D66637: [clangd] Support multifile edits as output of Tweaks

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 29 03:19:32 PDT 2019


sammccall added inline comments.


================
Comment at: clang-tools-extra/clangd/SourceCode.cpp:601
+          llvm::inconvertibleErrorCode(),
+          "File contents differ on disk for %s, please save", FilePath.data());
+    }
----------------
kadircet wrote:
> sammccall wrote:
> > you seem to be checking this both here and in clangdlspserver. Why?
> the contents in here are coming from disk, whereas the one in clangdlspserver is coming from drafts. I suppose it would make more sense to merge the two in clangdlspserver, use draft manager as content source backed by disk in case user hasn't opened that file.
OK, so you're checking here whether the contents-on-disk have changed between clang reading the file as part of parse, and the tweak completing?

I don't think this is worth doing. Sure, there's potentially a race condition, but it's relatively small (bounded on the order of a few seconds, vs unbounded for unsaved drafts) and we can't eliminate it entirely (file on disk can change between when we create edits and when they're applied).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66637





More information about the cfe-commits mailing list