annotate clang-tools-extra/clangd/FindSymbols.h @ 221:79ff65ed7e25

LLVM12 Original
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 15 Jun 2021 19:15:29 +0900
parents 0572611fdcc8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 //===--- FindSymbols.h --------------------------------------*- C++-*------===//
anatofuz
parents:
diff changeset
2 //
anatofuz
parents:
diff changeset
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
anatofuz
parents:
diff changeset
4 // See https://llvm.org/LICENSE.txt for license information.
anatofuz
parents:
diff changeset
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
anatofuz
parents:
diff changeset
6 //
anatofuz
parents:
diff changeset
7 //===----------------------------------------------------------------------===//
anatofuz
parents:
diff changeset
8 //
anatofuz
parents:
diff changeset
9 // Queries that provide a list of symbols matching a string.
anatofuz
parents:
diff changeset
10 //
anatofuz
parents:
diff changeset
11 //===----------------------------------------------------------------------===//
anatofuz
parents:
diff changeset
12 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_FINDSYMBOLS_H
anatofuz
parents:
diff changeset
13 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_FINDSYMBOLS_H
anatofuz
parents:
diff changeset
14
anatofuz
parents:
diff changeset
15 #include "Protocol.h"
anatofuz
parents:
diff changeset
16 #include "index/Symbol.h"
anatofuz
parents:
diff changeset
17 #include "llvm/ADT/StringRef.h"
anatofuz
parents:
diff changeset
18
anatofuz
parents:
diff changeset
19 namespace clang {
anatofuz
parents:
diff changeset
20 namespace clangd {
anatofuz
parents:
diff changeset
21 class ParsedAST;
anatofuz
parents:
diff changeset
22 class SymbolIndex;
anatofuz
parents:
diff changeset
23
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
24 /// Helper function for deriving an LSP Location from an index SymbolLocation.
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
25 llvm::Expected<Location> indexToLSPLocation(const SymbolLocation &Loc,
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
26 llvm::StringRef TUPath);
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
27
150
anatofuz
parents:
diff changeset
28 /// Helper function for deriving an LSP Location for a Symbol.
anatofuz
parents:
diff changeset
29 llvm::Expected<Location> symbolToLocation(const Symbol &Sym,
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
30 llvm::StringRef TUPath);
150
anatofuz
parents:
diff changeset
31
anatofuz
parents:
diff changeset
32 /// Searches for the symbols matching \p Query. The syntax of \p Query can be
anatofuz
parents:
diff changeset
33 /// the non-qualified name or fully qualified of a symbol. For example,
anatofuz
parents:
diff changeset
34 /// "vector" will match the symbol std::vector and "std::vector" would also
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
35 /// match it. Direct children of scopes (namespaces, etc) can be listed with a
150
anatofuz
parents:
diff changeset
36 /// trailing
anatofuz
parents:
diff changeset
37 /// "::". For example, "std::" will list all children of the std namespace and
anatofuz
parents:
diff changeset
38 /// "::" alone will list all children of the global namespace.
anatofuz
parents:
diff changeset
39 /// \p Limit limits the number of results returned (0 means no limit).
anatofuz
parents:
diff changeset
40 /// \p HintPath This is used when resolving URIs. If empty, URI resolution can
anatofuz
parents:
diff changeset
41 /// fail if a hint path is required for the scheme of a specific URI.
anatofuz
parents:
diff changeset
42 llvm::Expected<std::vector<SymbolInformation>>
anatofuz
parents:
diff changeset
43 getWorkspaceSymbols(llvm::StringRef Query, int Limit,
anatofuz
parents:
diff changeset
44 const SymbolIndex *const Index, llvm::StringRef HintPath);
anatofuz
parents:
diff changeset
45
anatofuz
parents:
diff changeset
46 /// Retrieves the symbols contained in the "main file" section of an AST in the
anatofuz
parents:
diff changeset
47 /// same order that they appear.
anatofuz
parents:
diff changeset
48 llvm::Expected<std::vector<DocumentSymbol>> getDocumentSymbols(ParsedAST &AST);
anatofuz
parents:
diff changeset
49
anatofuz
parents:
diff changeset
50 } // namespace clangd
anatofuz
parents:
diff changeset
51 } // namespace clang
anatofuz
parents:
diff changeset
52
anatofuz
parents:
diff changeset
53 #endif