clang-tools 20.0.0git
Public Types | Public Member Functions | List of all members
clang::clangd::SymbolIndex Class Referenceabstract

Interface for symbol indexes that can be used for searching or matching symbols among a set of symbols based on names or unique IDs. More...

#include <Index.h>

Inheritance diagram for clang::clangd::SymbolIndex:
Inheritance graph
[legend]

Public Types

using IndexedFiles = llvm::unique_function< IndexContents(llvm::StringRef) const >
 Returns function which checks if the specified file was used to build this index or not.
 

Public Member Functions

virtual ~SymbolIndex ()=default
 
virtual bool fuzzyFind (const FuzzyFindRequest &Req, llvm::function_ref< void(const Symbol &)> Callback) const =0
 Matches symbols in the index fuzzily and applies Callback on each matched symbol before returning.
 
virtual void lookup (const LookupRequest &Req, llvm::function_ref< void(const Symbol &)> Callback) const =0
 Looks up symbols with any of the given symbol IDs and applies Callback on each matched symbol.
 
virtual bool refs (const RefsRequest &Req, llvm::function_ref< void(const Ref &)> Callback) const =0
 Finds all occurrences (e.g.
 
virtual bool containedRefs (const ContainedRefsRequest &Req, llvm::function_ref< void(const ContainedRefsResult &)> Callback) const =0
 Find all symbols that are referenced by a symbol and apply Callback on each result.
 
virtual void relations (const RelationsRequest &Req, llvm::function_ref< void(const SymbolID &Subject, const Symbol &Object)> Callback) const =0
 Finds all relations (S, P, O) stored in the index such that S is among Req.Subjects and P is Req.Predicate, and invokes Callback for (S, O) in each.
 
virtual IndexedFiles indexedFiles () const =0
 
virtual size_t estimateMemoryUsage () const =0
 Returns estimated size of index (in bytes).
 

Detailed Description

Interface for symbol indexes that can be used for searching or matching symbols among a set of symbols based on names or unique IDs.

Definition at line 134 of file Index.h.

Member Typedef Documentation

◆ IndexedFiles

using clang::clangd::SymbolIndex::IndexedFiles = llvm::unique_function<IndexContents(llvm::StringRef) const>

Returns function which checks if the specified file was used to build this index or not.

The function must only be called while the index is alive.

Definition at line 186 of file Index.h.

Constructor & Destructor Documentation

◆ ~SymbolIndex()

virtual clang::clangd::SymbolIndex::~SymbolIndex ( )
virtualdefault

Member Function Documentation

◆ containedRefs()

virtual bool clang::clangd::SymbolIndex::containedRefs ( const ContainedRefsRequest Req,
llvm::function_ref< void(const ContainedRefsResult &)>  Callback 
) const
pure virtual

Find all symbols that are referenced by a symbol and apply Callback on each result.

Results should be returned in arbitrary order. The returned result must be deep-copied if it's used outside Callback.

Returns true if there will be more results (limited by Req.Limit);

Implemented in clang::clangd::SwapIndex, clang::clangd::MergedIndex, clang::clangd::dex::Dex, and clang::clangd::MemIndex.

Referenced by clang::clangd::MergedIndex::containedRefs().

◆ estimateMemoryUsage()

virtual size_t clang::clangd::SymbolIndex::estimateMemoryUsage ( ) const
pure virtual

◆ fuzzyFind()

virtual bool clang::clangd::SymbolIndex::fuzzyFind ( const FuzzyFindRequest Req,
llvm::function_ref< void(const Symbol &)>  Callback 
) const
pure virtual

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 Req.Limit).

Implemented in clang::clangd::SwapIndex, clang::clangd::MergedIndex, clang::clangd::dex::Dex, and clang::clangd::MemIndex.

Referenced by clang::clangd::MergedIndex::fuzzyFind(), and clang::clangd::match().

◆ indexedFiles()

virtual IndexedFiles clang::clangd::SymbolIndex::indexedFiles ( ) const
pure virtual

◆ lookup()

virtual void clang::clangd::SymbolIndex::lookup ( const LookupRequest Req,
llvm::function_ref< void(const Symbol &)>  Callback 
) const
pure virtual

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.

Implemented in clang::clangd::SwapIndex, clang::clangd::MergedIndex, clang::clangd::dex::Dex, and clang::clangd::MemIndex.

Referenced by clang::clangd::MergedIndex::lookup(), and clang::clangd::lookup().

◆ refs()

virtual bool clang::clangd::SymbolIndex::refs ( const RefsRequest Req,
llvm::function_ref< void(const Ref &)>  Callback 
) const
pure virtual

Finds all occurrences (e.g.

references, declarations, definitions) of symbols and applies Callback on each result.

Results should be returned in arbitrary order. The returned result must be deep-copied if it's used outside Callback. FIXME: there's no indication which result references which symbol.

Returns true if there will be more results (limited by Req.Limit);

Implemented in clang::clangd::SwapIndex, clang::clangd::MergedIndex, clang::clangd::dex::Dex, and clang::clangd::MemIndex.

Referenced by clang::clangd::MergedIndex::refs().

◆ relations()

virtual void clang::clangd::SymbolIndex::relations ( const RelationsRequest Req,
llvm::function_ref< void(const SymbolID &Subject, const Symbol &Object)>  Callback 
) const
pure virtual

Finds all relations (S, P, O) stored in the index such that S is among Req.Subjects and P is Req.Predicate, and invokes Callback for (S, O) in each.

Referenced by clang::clangd::MergedIndex::relations().


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