clang-tools 20.0.0git
|
Wrapper for vfs::FileSystem for use in multithreaded programs like clangd. More...
#include <ThreadsafeFS.h>
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. | |
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.
|
virtualdefault |
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().
|
inline |
Obtain a vfs::FileSystem with an arbitrary initial working directory.
Definition at line 32 of file ThreadsafeFS.h.
Referenced by clang::clangd::buildCompilerInvocation(), clang::clangd::buildPreamble(), clang::clangd::getFormatStyleForFile(), clang::clangd::indexStandardLibrary(), clang::clangd::isPreambleCompatible(), clang::clangd::ClangdServer::switchSourceHeader(), and view().