clang-tools 20.0.0git
|
A container of slabs associated with a key. More...
#include <FileIndex.h>
Public Member Functions | |
FileSymbols (IndexContents IdxContents) | |
void | update (llvm::StringRef Key, std::unique_ptr< SymbolSlab > Symbols, std::unique_ptr< RefSlab > Refs, std::unique_ptr< RelationSlab > Relations, bool CountReferences) |
Updates all slabs associated with the Key . | |
std::unique_ptr< SymbolIndex > | buildIndex (IndexType, DuplicateHandling DuplicateHandle=DuplicateHandling::PickOne, size_t *Version=nullptr) |
The index keeps the slabs alive. | |
void | profile (MemoryTree &MT) const |
A container of slabs associated with a key.
It can be updated at key granularity, replacing all slabs belonging to a key with a new set. Keys are usually file paths/uris.
This implements snapshot semantics. Each update will create a new snapshot for all slabs of the Key. Snapshots are managed with shared pointers that are shared between this class and the users. For each key, this class only stores a pointer pointing to the newest snapshot, and an outdated snapshot is deleted by the last owner of the snapshot, either this class or the symbol index.
The snapshot semantics keeps critical sections minimal since we only need locking when we swap or obtain references to snapshots.
Definition at line 70 of file FileIndex.h.
clang::clangd::FileSymbols::FileSymbols | ( | IndexContents | IdxContents | ) |
Definition at line 242 of file FileIndex.cpp.
std::unique_ptr< SymbolIndex > clang::clangd::FileSymbols::buildIndex | ( | IndexType | Type, |
DuplicateHandling | DuplicateHandle = DuplicateHandling::PickOne , |
||
size_t * | Version = nullptr |
||
) |
The index keeps the slabs alive.
Will count Symbol::References based on number of references in the main files, while building the index with DuplicateHandling::Merge option. Version is populated with an increasing sequence counter.
Definition at line 271 of file FileIndex.cpp.
References clang::clangd::RefSlab::bytes(), clang::clangd::Heavy, clang::clangd::Light, clang::clangd::Merge, clang::clangd::mergeSymbol(), clang::clangd::PickOne, and clang::clangd::Type.
Referenced by clang::clangd::FileIndex::updateMain(), and clang::clangd::FileIndex::updatePreamble().
void clang::clangd::FileSymbols::profile | ( | MemoryTree & | MT | ) | const |
Definition at line 403 of file FileIndex.cpp.
References clang::clangd::MemoryTree::addUsage(), clang::clangd::RefSlab::bytes(), clang::clangd::MemoryTree::child(), and clang::clangd::MemoryTree::detail().
Referenced by clang::clangd::BackgroundIndex::profile(), and clang::clangd::FileIndex::profile().
void clang::clangd::FileSymbols::update | ( | llvm::StringRef | Key, |
std::unique_ptr< SymbolSlab > | Symbols, | ||
std::unique_ptr< RefSlab > | Refs, | ||
std::unique_ptr< RelationSlab > | Relations, | ||
bool | CountReferences | ||
) |
Updates all slabs associated with the Key
.
If either is nullptr, corresponding data for Key
will be removed. If CountReferences is true, Refs
will be used for counting references during merging.
Definition at line 245 of file FileIndex.cpp.
References clang::clangd::Symbols.
Referenced by clang::clangd::FileIndex::updateMain(), and clang::clangd::FileIndex::updatePreamble().