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 SourcePaths, std::shared_ptr PCHContainerOps = - std::make_shared()); + std::make_shared(), + IntrusiveRefCntPtr BaseFS = + vfs::getRealFileSystem()); ~ClangTool(); Index: lib/Tooling/Tooling.cpp =================================================================== --- lib/Tooling/Tooling.cpp +++ lib/Tooling/Tooling.cpp @@ -328,10 +328,11 @@ ClangTool::ClangTool(const CompilationDatabase &Compilations, ArrayRef SourcePaths, - std::shared_ptr PCHContainerOps) + std::shared_ptr PCHContainerOps, + IntrusiveRefCntPtr 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) {