[PATCH] D91300: WIP: Frontend: Use an InMemoryFileSystem for the RemappedFiles parameter in ASTUnit

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 11 14:15:35 PST 2020


dexonsmith added a subscriber: kadircet.
dexonsmith added inline comments.


================
Comment at: clang/lib/Frontend/PrecompiledPreamble.cpp:571-579
+    if (OverriddenFilesFS) {
+      std::unique_ptr<llvm::MemoryBuffer> Buffer;
+      if (moveOnNoError(OverriddenFilesFS->getBufferForFile(F.first()),
+                        Buffer)) {
+        if (PreambleFileHash::createForMemoryBuffer(*Buffer) != F.second)
+          return false;
+        continue;
----------------
@kadircet, I'm curious if clang-tools-extra/clangd/Preamble.cpp's call to `ASTUnit::CanReuse` would benefit from this logic as well. I would guess clangd doesn't even try to reuse preambles when unsaved files have changed (since you might see the same crashes or wrong results I saw before adding this), but after this patch lands you might be able to do that safely.


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

https://reviews.llvm.org/D91300



More information about the cfe-commits mailing list