brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · 5fb116b Raw
54 lines · c
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-exception6//7//===----------------------------------------------------------------------===//8//9// Queries that provide a list of symbols matching a string.10//11//===----------------------------------------------------------------------===//12#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_FINDSYMBOLS_H13#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_FINDSYMBOLS_H14 15#include "Protocol.h"16#include "index/Symbol.h"17#include "llvm/ADT/StringRef.h"18 19namespace clang {20namespace clangd {21class ParsedAST;22class SymbolIndex;23 24/// Helper function for deriving an LSP Location from an index SymbolLocation.25llvm::Expected<Location> indexToLSPLocation(const SymbolLocation &Loc,26                                            llvm::StringRef TUPath);27 28/// Helper function for deriving an LSP Location for a Symbol.29llvm::Expected<Location> symbolToLocation(const Symbol &Sym,30                                          llvm::StringRef TUPath);31 32/// Searches for the symbols matching \p Query. The syntax of \p Query can be33/// the non-qualified name or fully qualified of a symbol. For example,34/// "vector" will match the symbol std::vector and "std::vector" would also35/// match it. Direct children of scopes (namespaces, etc) can be listed with a36/// trailing37/// "::". For example, "std::" will list all children of the std namespace and38/// "::" 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 can41/// fail if a hint path is required for the scheme of a specific URI.42llvm::Expected<std::vector<SymbolInformation>>43getWorkspaceSymbols(llvm::StringRef Query, int Limit,44                    const SymbolIndex *const Index, llvm::StringRef HintPath);45 46/// Retrieves the symbols contained in the "main file" section of an AST in the47/// same order that they appear.48llvm::Expected<std::vector<DocumentSymbol>> getDocumentSymbols(ParsedAST &AST);49 50} // namespace clangd51} // namespace clang52 53#endif54