clang-tools 19.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 (std::nullopt_t CWD) const
 Obtain a vfs::FileSystem with an arbitrary initial working directory.
 
llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > view (PathRef CWD) const
 Obtain a vfs::FileSystem with a specified working directory.
 

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 26 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 ( 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 75 of file ThreadsafeFS.cpp.

References clang::clangd::elog(), and view().

◆ view() [2/2]

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

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