clang-tools  14.0.0git
ProjectAware.h
Go to the documentation of this file.
1 //===--- ProjectAware.h ------------------------------------------*- 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_INDEX_PROJECT_AWARE_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_PROJECT_AWARE_H
11 
12 #include "Config.h"
13 #include "index/Index.h"
14 #include "support/Threading.h"
15 #include <functional>
16 #include <memory>
17 namespace clang {
18 namespace clangd {
19 
20 /// A functor to create an index for an external index specification. Functor
21 /// should perform any high latency operation in a separate thread through
22 /// AsyncTaskRunner, if set.
23 /// Spec is never `None`.
24 using IndexFactory = std::function<std::unique_ptr<SymbolIndex>(
26 
27 /// Returns an index that answers queries using external indices. IndexFactory
28 /// specifies how to generate an index from an external source. If \p Sync is
29 /// set, index won't own any asnyc task runner.
30 /// IndexFactory must be injected because this code cannot depend on the remote
31 /// index client.
32 std::unique_ptr<SymbolIndex> createProjectAwareIndex(IndexFactory, bool Sync);
33 } // namespace clangd
34 } // namespace clang
35 
36 #endif
clang::clangd::createProjectAwareIndex
std::unique_ptr< SymbolIndex > createProjectAwareIndex(IndexFactory Gen, bool Sync)
Returns an index that answers queries using external indices.
Definition: ProjectAware.cpp:142
Index.h
Threading.h
Config.h
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ApplyReplacements.h:27
clang::clangd::Config::ExternalIndexSpec
Describes an external index configuration.
Definition: Config.h:72
clang::clangd::AsyncTaskRunner
Runs tasks on separate (detached) threads and wait for all tasks to finish.
Definition: Threading.h:106
clang::clangd::IndexFactory
std::function< std::unique_ptr< SymbolIndex >(const Config::ExternalIndexSpec &, AsyncTaskRunner *)> IndexFactory
A functor to create an index for an external index specification.
Definition: ProjectAware.h:25