clang-tools  14.0.0git
Public Member Functions | List of all members
clang::clangd::ThreadsafeFS Class Referenceabstract

Wrapper for vfs::FileSystem for use in multithreaded programs like clangd. More...

#include <ThreadsafeFS.h>

Inheritance diagram for clang::clangd::ThreadsafeFS:
Inheritance graph
[legend]

Public Member Functions

virtual ~ThreadsafeFS ()=default
 
llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > view (llvm::NoneType CWD) const
 Obtain a vfs::FileSystem with an arbitrary initial working directory. More...
 
llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > view (PathRef CWD) const
 Obtain a vfs::FileSystem with a specified working directory. More...
 

Detailed Description

Wrapper for vfs::FileSystem for use in multithreaded programs like clangd.

As FileSystem is not threadsafe, concurrent threads must each obtain one. Implementations may choose to depend on Context::current() e.g. to implement snapshot semantics. clangd will not create vfs::FileSystems for use in different contexts, so either ThreadsafeFS::view or the returned FS may contain this logic.

Definition at line 28 of file ThreadsafeFS.h.

Constructor & Destructor Documentation

◆ ~ThreadsafeFS()

virtual clang::clangd::ThreadsafeFS::~ThreadsafeFS ( )
virtualdefault

Member Function Documentation

◆ view() [1/2]

llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> clang::clangd::ThreadsafeFS::view ( llvm::NoneType  CWD) const
inline

◆ view() [2/2]

llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > clang::clangd::ThreadsafeFS::view ( PathRef  CWD) const

Obtain a vfs::FileSystem with a specified working directory.

If the working directory can't be set (e.g. doesn't exist), logs and returns the FS anyway.

Definition at line 78 of file ThreadsafeFS.cpp.


The documentation for this class was generated from the following files: