//===--- ThreadsafeFS.cpp -------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "support/ThreadsafeFS.h" #include "Logger.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Path.h" #include "llvm/Support/VirtualFileSystem.h" #include <memory> namespace clang { namespace clangd { namespace { /// Always opens files in the underlying filesystem as "volatile", meaning they /// won't be memory-mapped. Memory-mapping isn't desirable for clangd: /// - edits to the underlying files change contents MemoryBuffers owned by // SourceManager, breaking its invariants and leading to crashes /// - it locks files on windows, preventing edits class VolatileFileSystem : public llvm::vfs::ProxyFileSystem { … }; } // namespace llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> ThreadsafeFS::view(PathRef CWD) const { … } llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> RealThreadsafeFS::viewImpl() const { … } } // namespace clangd } // namespace clang