clang-tools 20.0.0git
|
This manages symbols from files and an in-memory index on all symbols. More...
#include <FileIndex.h>
Public Member Functions | |
FileIndex (bool SupportContainedRefs) | |
void | updatePreamble (PathRef Path, llvm::StringRef Version, ASTContext &AST, Preprocessor &PP, const include_cleaner::PragmaIncludes &PI) |
Update preamble symbols of file Path with all declarations in AST and macros in PP . | |
void | updatePreamble (IndexFileIn) |
void | updateMain (PathRef Path, ParsedAST &AST) |
Update symbols and references from main file Path with indexMainDecls . | |
void | profile (MemoryTree &MT) const |
Public Member Functions inherited from clang::clangd::MergedIndex | |
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. | |
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 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). | |
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. | |
This manages symbols from files and an in-memory index on all symbols.
FIXME: Expose an interface to remove files that are closed.
Definition at line 110 of file FileIndex.h.
clang::clangd::FileIndex::FileIndex | ( | bool | SupportContainedRefs | ) |
Definition at line 422 of file FileIndex.cpp.
void clang::clangd::FileIndex::profile | ( | MemoryTree & | MT | ) | const |
Definition at line 496 of file FileIndex.cpp.
References clang::clangd::MemoryTree::addUsage(), clang::clangd::MemoryTree::child(), clang::clangd::SwapIndex::estimateMemoryUsage(), and clang::clangd::FileSymbols::profile().
Update symbols and references from main file Path
with indexMainDecls
.
Definition at line 470 of file FileIndex.cpp.
References clang::clangd::AST, clang::clangd::FileSymbols::buildIndex(), clang::clangd::URI::create(), clang::clangd::SwapIndex::estimateMemoryUsage(), clang::clangd::indexMainDecls(), clang::clangd::Light, clang::clangd::Merge, clang::clangd::SwapIndex::reset(), clang::clangd::toString(), clang::clangd::FileSymbols::update(), and clang::clangd::vlog().
void clang::clangd::FileIndex::updatePreamble | ( | IndexFileIn | IF | ) |
Definition at line 430 of file FileIndex.cpp.
References clang::clangd::FileSymbols::buildIndex(), clang::clangd::SwapIndex::estimateMemoryUsage(), clang::clangd::FileShardedIndex::getAllSources(), clang::clangd::FileShardedIndex::getShard(), clang::clangd::Heavy, clang::clangd::PickOne, clang::clangd::IndexFileIn::Relations, clang::clangd::SwapIndex::reset(), clang::clangd::IndexFileIn::Symbols, clang::clangd::FileSymbols::update(), and clang::clangd::vlog().
void clang::clangd::FileIndex::updatePreamble | ( | PathRef | Path, |
llvm::StringRef | Version, | ||
ASTContext & | AST, | ||
Preprocessor & | PP, | ||
const include_cleaner::PragmaIncludes & | PI | ||
) |
Update preamble symbols of file Path
with all declarations in AST
and macros in PP
.
Definition at line 461 of file FileIndex.cpp.
References clang::clangd::AST, clang::clangd::indexHeaderSymbols(), clang::clangd::IndexFileIn::Relations, clang::clangd::IndexFileIn::Symbols, and updatePreamble().
Referenced by updatePreamble().