clang-tools  7.0.0
Public Member Functions | Static Public Member Functions | List of all members
clang::clangd::MemIndex Class Reference

This implements an index for a (relatively small) set of symbols that can be easily managed in memory. More...

#include <MemIndex.h>

Inheritance diagram for clang::clangd::MemIndex:
[legend]
Collaboration diagram for clang::clangd::MemIndex:
[legend]

Public Member Functions

void build (std::shared_ptr< std::vector< const Symbol *>> Symbols)
 (Re-)Build index for Symbols. More...
 
bool fuzzyFind (const FuzzyFindRequest &Req, llvm::function_ref< void(const Symbol &)> Callback) const override
 Matches symbols in the index fuzzily and applies Callback on each matched symbol before returning. More...
 
virtual void lookup (const LookupRequest &Req, llvm::function_ref< void(const Symbol &)> Callback) const override
 Looks up symbols with any of the given symbol IDs and applies Callback on each matched symbol. More...
 
- Public Member Functions inherited from clang::clangd::SymbolIndex
virtual ~SymbolIndex ()=default
 

Static Public Member Functions

static std::unique_ptr< SymbolIndexbuild (SymbolSlab Slab)
 Build index from a symbol slab. More...
 

Detailed Description

This implements an index for a (relatively small) set of symbols that can be easily managed in memory.

Definition at line 21 of file MemIndex.h.

Member Function Documentation

◆ build() [1/2]

void clang::clangd::MemIndex::build ( std::shared_ptr< std::vector< const Symbol *>>  Symbols)

(Re-)Build index for Symbols.

All symbol pointers must remain accessible as long as Symbols is kept alive.

Definition at line 18 of file MemIndex.cpp.

◆ build() [2/2]

std::unique_ptr< SymbolIndex > clang::clangd::MemIndex::build ( SymbolSlab  Slab)
static

Build index from a symbol slab.

Definition at line 74 of file MemIndex.cpp.

◆ fuzzyFind()

bool clang::clangd::MemIndex::fuzzyFind ( const FuzzyFindRequest Req,
llvm::function_ref< void(const Symbol &)>  Callback 
) const
overridevirtual

Matches symbols in the index fuzzily and applies Callback on each matched symbol before returning.

If returned Symbols are used outside Callback, they must be deep-copied!

Returns true if there may be more results (limited by MaxCandidateCount).

Implements clang::clangd::SymbolIndex.

Definition at line 31 of file MemIndex.cpp.

References clang::clangd::Symbol::IsIndexedForCodeCompletion, clang::clangd::FuzzyMatcher::match(), clang::clangd::FuzzyFindRequest::MaxCandidateCount, clang::clangd::Symbol::Name, clang::clangd::quality(), clang::clangd::FuzzyFindRequest::Query, clang::clangd::FuzzyFindRequest::RestrictForCodeCompletion, clang::clangd::Symbol::Scope, and clang::clangd::FuzzyFindRequest::Scopes.

◆ lookup()

void clang::clangd::MemIndex::lookup ( const LookupRequest Req,
llvm::function_ref< void(const Symbol &)>  Callback 
) const
overridevirtual

Looks up symbols with any of the given symbol IDs and applies Callback on each matched symbol.

The returned symbol must be deep-copied if it's used outside Callback.

Implements clang::clangd::SymbolIndex.

Definition at line 65 of file MemIndex.cpp.

References clang::clangd::LookupRequest::IDs.


The documentation for this class was generated from the following files: