[Clang] replace 'bitfield' with 'bit-field' for consistency (#117881)
[llvm-project.git] / clang-tools-extra / clangd / FindSymbols.h
blob5fb116b13d1136a2aa9cd8ae0d92f7671df58545
1 //===--- FindSymbols.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 // Queries that provide a list of symbols matching a string.
11 //===----------------------------------------------------------------------===//
12 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_FINDSYMBOLS_H
13 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_FINDSYMBOLS_H
15 #include "Protocol.h"
16 #include "index/Symbol.h"
17 #include "llvm/ADT/StringRef.h"
19 namespace clang {
20 namespace clangd {
21 class ParsedAST;
22 class SymbolIndex;
24 /// Helper function for deriving an LSP Location from an index SymbolLocation.
25 llvm::Expected<Location> indexToLSPLocation(const SymbolLocation &Loc,
26 llvm::StringRef TUPath);
28 /// Helper function for deriving an LSP Location for a Symbol.
29 llvm::Expected<Location> symbolToLocation(const Symbol &Sym,
30 llvm::StringRef TUPath);
32 /// Searches for the symbols matching \p Query. The syntax of \p Query can be
33 /// the non-qualified name or fully qualified of a symbol. For example,
34 /// "vector" will match the symbol std::vector and "std::vector" would also
35 /// match it. Direct children of scopes (namespaces, etc) can be listed with a
36 /// trailing
37 /// "::". For example, "std::" will list all children of the std namespace and
38 /// "::" alone will list all children of the global namespace.
39 /// \p Limit limits the number of results returned (0 means no limit).
40 /// \p HintPath This is used when resolving URIs. If empty, URI resolution can
41 /// fail if a hint path is required for the scheme of a specific URI.
42 llvm::Expected<std::vector<SymbolInformation>>
43 getWorkspaceSymbols(llvm::StringRef Query, int Limit,
44 const SymbolIndex *const Index, llvm::StringRef HintPath);
46 /// Retrieves the symbols contained in the "main file" section of an AST in the
47 /// same order that they appear.
48 llvm::Expected<std::vector<DocumentSymbol>> getDocumentSymbols(ParsedAST &AST);
50 } // namespace clangd
51 } // namespace clang
53 #endif