clang-tools  8.0.0
XRefs.h
Go to the documentation of this file.
1 //===--- XRefs.h -------------------------------------------------*- C++-*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // Features that traverse references between symbols.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_XREFS_H
15 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_XREFS_H
16 
17 #include "ClangdUnit.h"
18 #include "Protocol.h"
19 #include "index/Index.h"
20 #include "llvm/ADT/Optional.h"
21 #include <vector>
22 
23 namespace clang {
24 namespace clangd {
25 
26 /// Get definition of symbol at a specified \p Pos.
27 std::vector<Location> findDefinitions(ParsedAST &AST, Position Pos,
28  const SymbolIndex *Index = nullptr);
29 
30 /// Returns highlights for all usages of a symbol at \p Pos.
31 std::vector<DocumentHighlight> findDocumentHighlights(ParsedAST &AST,
32  Position Pos);
33 
34 /// Get the hover information when hovering at \p Pos.
35 llvm::Optional<Hover> getHover(ParsedAST &AST, Position Pos);
36 
37 /// Returns reference locations of the symbol at a specified \p Pos.
38 /// \p Limit limits the number of results returned (0 means no limit).
39 std::vector<Location> findReferences(ParsedAST &AST, Position Pos,
40  uint32_t Limit,
41  const SymbolIndex *Index = nullptr);
42 
43 /// Get info about symbols at \p Pos.
44 std::vector<SymbolDetails> getSymbolInfo(ParsedAST &AST, Position Pos);
45 
46 } // namespace clangd
47 } // namespace clang
48 
49 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_XREFS_H
llvm::Optional< Hover > getHover(ParsedAST &AST, Position Pos)
Get the hover information when hovering at Pos.
Definition: XRefs.cpp:686
std::vector< Location > findDefinitions(ParsedAST &AST, Position Pos, const SymbolIndex *Index)
Get definition of symbol at a specified Pos.
Definition: XRefs.cpp:244
std::vector< SymbolDetails > getSymbolInfo(ParsedAST &AST, Position Pos)
Get info about symbols at Pos.
Definition: XRefs.cpp:765
std::vector< DocumentHighlight > findDocumentHighlights(ParsedAST &AST, Position Pos)
Returns highlights for all usages of a symbol at Pos.
Definition: XRefs.cpp:434
Position Pos
std::vector< Location > findReferences(ParsedAST &AST, Position Pos, uint32_t Limit, const SymbolIndex *Index)
Returns reference locations of the symbol at a specified Pos.
Definition: XRefs.cpp:706
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
const SymbolIndex * Index
Definition: Dexp.cpp:85