clang-tools 22.0.0git
clang::clangd::SwapIndex Class Reference

#include <Index.h>

Inheritance diagram for clang::clangd::SwapIndex:
[legend]

Public Member Functions

 SwapIndex (std::unique_ptr< SymbolIndex > Index=nullptr)
void reset (std::unique_ptr< SymbolIndex >)
bool fuzzyFind (const FuzzyFindRequest &, llvm::function_ref< void(const Symbol &)>) const override
 Matches symbols in the index fuzzily and applies Callback on each matched symbol before returning.
void lookup (const LookupRequest &, llvm::function_ref< void(const Symbol &)>) const override
 Looks up symbols with any of the given symbol IDs and applies Callback on each matched symbol.
bool refs (const RefsRequest &, llvm::function_ref< void(const Ref &)>) const override
 Finds all occurrences (e.g.
bool containedRefs (const ContainedRefsRequest &, llvm::function_ref< void(const ContainedRefsResult &)>) const override
 Find all symbols that are referenced by a symbol and apply Callback on each result.
void relations (const RelationsRequest &, llvm::function_ref< void(const SymbolID &, const Symbol &)>) const override
llvm::unique_function< IndexContents(llvm::StringRef) const > indexedFiles () const override
size_t estimateMemoryUsage () const override
 Returns estimated size of index (in bytes).
Public Member Functions inherited from clang::clangd::SymbolIndex
virtual ~SymbolIndex ()=default
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.

Additional Inherited Members

Public Types inherited from clang::clangd::SymbolIndex
using IndexedFiles
 Returns function which checks if the specified file was used to build this index or not.

Detailed Description

Definition at line 195 of file Index.h.

Constructor & Destructor Documentation

◆ SwapIndex()

clang::clangd::SwapIndex::SwapIndex ( std::unique_ptr< SymbolIndex > Index = nullptr)
inline

Definition at line 198 of file Index.h.

Referenced by clang::clangd::BackgroundIndex::BackgroundIndex().

Member Function Documentation

◆ containedRefs()

bool clang::clangd::SwapIndex::containedRefs ( const ContainedRefsRequest & Req,
llvm::function_ref< void(const ContainedRefsResult &)> Callback ) const
overridevirtual

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);

Implements clang::clangd::SymbolIndex.

Definition at line 69 of file Index.cpp.

◆ estimateMemoryUsage()

size_t clang::clangd::SwapIndex::estimateMemoryUsage ( ) const
overridevirtual

Returns estimated size of index (in bytes).

Implements clang::clangd::SymbolIndex.

Definition at line 91 of file Index.cpp.

Referenced by clang::clangd::BackgroundIndex::profile().

◆ fuzzyFind()

bool clang::clangd::SwapIndex::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 Req.Limit).

Implements clang::clangd::SymbolIndex.

Definition at line 57 of file Index.cpp.

◆ indexedFiles()

llvm::unique_function< IndexContents(llvm::StringRef) const > clang::clangd::SwapIndex::indexedFiles ( ) const
overridevirtual

Implements clang::clangd::SymbolIndex.

Definition at line 81 of file Index.cpp.

References clang::clangd::File.

◆ lookup()

void clang::clangd::SwapIndex::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 61 of file Index.cpp.

◆ refs()

bool clang::clangd::SwapIndex::refs ( const RefsRequest & Req,
llvm::function_ref< void(const Ref &)> Callback ) const
overridevirtual

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);

Implements clang::clangd::SymbolIndex.

Definition at line 65 of file Index.cpp.

◆ relations()

void clang::clangd::SwapIndex::relations ( const RelationsRequest & R,
llvm::function_ref< void(const SymbolID &, const Symbol &)> CB ) const
override

Definition at line 74 of file Index.cpp.

◆ reset()

void clang::clangd::SwapIndex::reset ( std::unique_ptr< SymbolIndex > Index)

Definition at line 16 of file Index.cpp.


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