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

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 23 05:21:04 PDT 2019


ilya-biryukov added inline comments.


================
Comment at: clang-tools-extra/clangd/ClangdLSPServer.cpp:644
+          assert(It.second.Edits && "TextEdits hasn't been generated?");
+          if (auto Draft = DraftMgr.getDraft(It.first())) {
+            llvm::StringRef Contents = *Draft;
----------------
This callback is called asynchronously and the version inside `DraftMgr` may be newer than the one we used to calculate the original offsets inside replacements at this point.

We should not rely on `DraftMgr`, doing conversions on the source buffers inside `SourceManager` is probably the most reliable option we have.


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