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

This manages symbls from files and an in-memory index on all symbols. More...

#include <FileIndex.h>

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

Public Member Functions

 FileIndex (std::vector< std::string > URISchemes={})
 If URISchemes is empty, the default schemes in SymbolCollector will be used. More...
 
void update (PathRef Path, ASTContext *AST, std::shared_ptr< Preprocessor > PP)
 Update symbols in Path with symbols in AST. 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...
 
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
 

Detailed Description

This manages symbls from files and an in-memory index on all symbols.

Definition at line 57 of file FileIndex.h.

Constructor & Destructor Documentation

◆ FileIndex()

clang::clangd::FileIndex::FileIndex ( std::vector< std::string >  URISchemes = {})

If URISchemes is empty, the default schemes in SymbolCollector will be used.

Definition at line 48 of file FileIndex.cpp.

Member Function Documentation

◆ fuzzyFind()

bool clang::clangd::FileIndex::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 96 of file FileIndex.cpp.

◆ lookup()

void clang::clangd::FileIndex::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 102 of file FileIndex.cpp.

◆ update()

void clang::clangd::FileIndex::update ( PathRef  Path,
ASTContext *  AST,
std::shared_ptr< Preprocessor >  PP 
)

Update symbols in Path with symbols in AST.

If AST is nullptr, this removes all symbols in the file. If AST is not null, PP cannot be null and it should be the preprocessor that was used to build AST.

Definition at line 82 of file FileIndex.cpp.


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