clang-tools 20.0.0git
Public Member Functions | List of all members
clang::clangd::MergedIndex Class Reference

#include <Merge.h>

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

Public Member Functions

 MergedIndex (const SymbolIndex *Dynamic, const SymbolIndex *Static)
 
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.
 
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 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 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).
 

Additional Inherited Members

- Public Types inherited from clang::clangd::SymbolIndex
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.
 

Detailed Description

Definition at line 26 of file Merge.h.

Constructor & Destructor Documentation

◆ MergedIndex()

clang::clangd::MergedIndex::MergedIndex ( const SymbolIndex Dynamic,
const SymbolIndex Static 
)
inline

Definition at line 32 of file Merge.h.

References Static.

Member Function Documentation

◆ estimateMemoryUsage()

size_t clang::clangd::MergedIndex::estimateMemoryUsage ( ) const
inlineoverridevirtual

Returns estimated size of index (in bytes).

Implements clang::clangd::SymbolIndex.

Definition at line 46 of file Merge.h.

References clang::clangd::SymbolIndex::estimateMemoryUsage(), and Static.

◆ fuzzyFind()

bool clang::clangd::MergedIndex::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 34 of file Merge.cpp.

References clang::clangd::SymbolSlab::end(), clang::clangd::SymbolSlab::find(), clang::clangd::SymbolIndex::fuzzyFind(), clang::clangd::SymbolIndex::indexedFiles(), clang::clangd::SymbolSlab::Builder::insert(), and SPAN_ATTACH.

◆ indexedFiles()

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

Implements clang::clangd::SymbolIndex.

Definition at line 159 of file Merge.cpp.

References clang::clangd::SymbolIndex::indexedFiles().

◆ lookup()

void clang::clangd::MergedIndex::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 91 of file Merge.cpp.

References ID, clang::clangd::LookupRequest::IDs, clang::clangd::SymbolIndex::indexedFiles(), and clang::clangd::SymbolIndex::lookup().

◆ refs()

bool clang::clangd::MergedIndex::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 125 of file Merge.cpp.

References clang::clangd::SymbolLocation::FileURI, clang::clangd::SymbolIndex::indexedFiles(), clang::clangd::RefsRequest::Limit, clang::clangd::Ref::Location, clang::clangd::None, clang::clangd::References, and clang::clangd::SymbolIndex::refs().

◆ relations()

void clang::clangd::MergedIndex::relations ( const RelationsRequest Req,
llvm::function_ref< void(const SymbolID &, const Symbol &)>  Callback 
) const
override

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