[PATCH] D45094: [LibTooling] Make interface of VFS injection into ClangTool more user-friendly

Whisperity via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 30 08:36:13 PDT 2018


whisperity created this revision.
whisperity added reviewers: alexfh, klimek.
whisperity added a project: clang.
Herald added subscribers: dkrupp, rnkovacs.

This patch extends upon https://reviews.llvm.org/D41947 because the interface that was landed from that patch isn't much user-friendly.

Injecting a custom virtual file system into the tool is a dangerous operation. If the real file system (where the installed Clang's headers reside) are not mirrored, it only turns out at `ClangTool::run()` that something was not mounted properly. Originally, the execution of a `ClangTool` always used the real filesystem.

Starting with https://reviews.llvm.org/D41947, the client code setting the tool up must manually create the OverlayFS  (which is, in turn, added as an OverlayFS into the tool' inner OverlayFS) containing the real system and the user's intention. I believe this logic should not be duplicated in client code, and the more traditional use-case of overlaying the filesystem view with some files, but by default keeping the real deal beneath it must be reflected better on the interface. Client code can now much more **explicitly** specify the complete cessation of real filesystem usage.


Repository:
  rC Clang

https://reviews.llvm.org/D45094

Files:
  include/clang/Tooling/Tooling.h
  lib/Tooling/Tooling.cpp
  unittests/Tooling/ToolingTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45094.140432.patch
Type: text/x-patch
Size: 6090 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180330/5b6eb37c/attachment.bin>


More information about the cfe-commits mailing list