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

A container of Symbols from several source files. More...

#include <FileIndex.h>

Public Member Functions

void update (PathRef Path, std::unique_ptr< SymbolSlab > Slab)
 Updates all symbols in a file. More...
 
std::shared_ptr< std::vector< const Symbol * > > allSymbols ()
 

Detailed Description

A container of Symbols from several source files.

It can be updated at source-file granularity, replacing all symbols from one file with a new set.

This implements a snapshot semantics for symbols in a file. Each update to a file will create a new snapshot for all symbols in the file. Snapshots are managed with shared pointers that are shared between this class and the users. For each file, 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 refereces to snapshots.

Definition at line 40 of file FileIndex.h.

Member Function Documentation

◆ allSymbols()

std::shared_ptr< std::vector< const Symbol * > > clang::clangd::FileSymbols::allSymbols ( )

Definition at line 59 of file FileIndex.cpp.

◆ update()

void clang::clangd::FileSymbols::update ( PathRef  Path,
std::unique_ptr< SymbolSlab Slab 
)

Updates all symbols in a file.

If Slab is nullptr, symbols for Path will be removed.

Definition at line 51 of file FileIndex.cpp.


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