[PATCH] D54077: [clangd] Implemented DraftFileSystem

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 5 02:32:04 PST 2018

ilya-biryukov added subscribers: simark, klimek.
ilya-biryukov added a comment.

Thanks for the patch! I believe many people I talked to want this behavior (myself included).
Some people like what we do now more. It feels like it depends on the workflow: for people who auto-save *all* files  before build (some editors do it automatically?) the new behavior is the right one, for people who only save current file and rerun build on the console the old behavior is the correct one.
It all boils down to the argument "I want to see same errors that running the compiler would produce".

@klimek, @arphaman, @simark, WDYT?

Comment at: clangd/FS.h:82
+    if (auto D = DS.getDraft(Path.str())) {
+      return std::unique_ptr<llvm::vfs::File>(
This assumes the `Path` is absolute and `vfs::FileSystem` can be called with non-absolute paths too.
One way to make it work with relative paths is to create an `InMemoryFileSystem` with the headers (it handles the absolute paths conversions) and create an `OverlayFileSystem` on top of it and the `RealFileSystem`.

This would also make more complicated things work, e.g. getting the same files when traversing parent directories, etc.

Could we try this approach? WDYT?

  rCTE Clang Tools Extra


More information about the cfe-commits mailing list