comparison clang-tools-extra/clangd/support/FSProvider.h @ 173:0572611fdcc8 llvm10 llvm12

reorgnization done
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 11:55:54 +0900
parents
children
comparison
equal deleted inserted replaced
172:9fbae9c8bf63 173:0572611fdcc8
1 //===--- FSProvider.h - VFS provider for ClangdServer ------------*- C++-*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_SUPPORT_FSPROVIDER_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_SUPPORT_FSPROVIDER_H
11
12 #include "llvm/ADT/IntrusiveRefCntPtr.h"
13 #include "llvm/Support/VirtualFileSystem.h"
14
15 namespace clang {
16 namespace clangd {
17
18 // Wrapper for vfs::FileSystem for use in multithreaded programs like clangd.
19 // As FileSystem is not threadsafe, concurrent threads must each obtain one.
20 class FileSystemProvider {
21 public:
22 virtual ~FileSystemProvider() = default;
23 /// Called by ClangdServer to obtain a vfs::FileSystem to be used for parsing.
24 /// Context::current() will be the context passed to the clang entrypoint,
25 /// such as addDocument(), and will also be propagated to result callbacks.
26 /// Embedders may use this to isolate filesystem accesses.
27 virtual llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>
28 getFileSystem() const = 0;
29 };
30
31 class RealFileSystemProvider : public FileSystemProvider {
32 public:
33 llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>
34 getFileSystem() const override;
35 };
36
37 } // namespace clangd
38 } // namespace clang
39
40 #endif