[PATCH] D41947: Provide default virtual filesystem argument in ClangTool constructor

Vladimir Plyashkun via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 11 05:50:37 PST 2018


vladimir.plyashkun created this revision.
vladimir.plyashkun added reviewers: alexfh, ilya-biryukov.
vladimir.plyashkun added a project: clang.
Herald added a subscriber: klimek.

This revision is part of another review.
Check this link for more details - https://reviews.llvm.org/D41535


Repository:
  rC Clang

https://reviews.llvm.org/D41947

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


Index: lib/Tooling/Tooling.cpp
===================================================================
--- lib/Tooling/Tooling.cpp
+++ lib/Tooling/Tooling.cpp
@@ -328,10 +328,11 @@
 
 ClangTool::ClangTool(const CompilationDatabase &Compilations,
                      ArrayRef<std::string> SourcePaths,
-                     std::shared_ptr<PCHContainerOperations> PCHContainerOps)
+                     std::shared_ptr<PCHContainerOperations> PCHContainerOps,
+                     IntrusiveRefCntPtr<vfs::FileSystem> BaseFS)
     : Compilations(Compilations), SourcePaths(SourcePaths),
       PCHContainerOps(std::move(PCHContainerOps)),
-      OverlayFileSystem(new vfs::OverlayFileSystem(vfs::getRealFileSystem())),
+      OverlayFileSystem(new vfs::OverlayFileSystem(BaseFS)),
       InMemoryFileSystem(new vfs::InMemoryFileSystem),
       Files(new FileManager(FileSystemOptions(), OverlayFileSystem)),
       DiagConsumer(nullptr) {
Index: include/clang/Tooling/Tooling.h
===================================================================
--- include/clang/Tooling/Tooling.h
+++ include/clang/Tooling/Tooling.h
@@ -296,10 +296,13 @@
   ///        not found in Compilations, it is skipped.
   /// \param PCHContainerOps The PCHContainerOperations for loading and creating
   /// clang modules.
+  /// \param BaseFS Base virtual filesystem used for OverlayFileSystem creation
   ClangTool(const CompilationDatabase &Compilations,
             ArrayRef<std::string> SourcePaths,
             std::shared_ptr<PCHContainerOperations> PCHContainerOps =
-                std::make_shared<PCHContainerOperations>());
+                std::make_shared<PCHContainerOperations>(),
+            IntrusiveRefCntPtr<vfs::FileSystem> BaseFS = 
+                vfs::getRealFileSystem());
 
   ~ClangTool();
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41947.129439.patch
Type: text/x-patch
Size: 1798 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180111/73ac3cbd/attachment.bin>


More information about the cfe-commits mailing list