LLDB  mainline
Public Member Functions | Private Attributes | List of all members
lldb_private::ConstStringTable Class Reference

Many cache files require string tables to store data efficiently. More...

#include <DataFileCache.h>

Collaboration diagram for lldb_private::ConstStringTable:
Collaboration graph
[legend]

Public Member Functions

 ConstStringTable ()=default
 
uint32_t Add (ConstString s)
 Add a string into the string table. More...
 
bool Encode (DataEncoder &encoder)
 

Private Attributes

std::vector< ConstStringm_strings
 
llvm::DenseMap< ConstString, uint32_tm_string_to_offset
 
uint32_t m_next_offset = 1
 Skip one byte to start the string table off with an empty string. More...
 

Detailed Description

Many cache files require string tables to store data efficiently.

This class helps create string tables.

Definition at line 170 of file DataFileCache.h.

Constructor & Destructor Documentation

◆ ConstStringTable()

lldb_private::ConstStringTable::ConstStringTable ( )
default

Member Function Documentation

◆ Add()

uint32_t ConstStringTable::Add ( ConstString  s)

Add a string into the string table.

Add a string to the string table will only add the same string one time and will return the offset in the string table buffer to that string. String tables are easy to build with ConstString objects since most LLDB classes for symbol or debug info use them already and they provide permanent storage for the string.

Parameters
sThe string to insert into the string table.
Returns
The byte offset from the start of the string table for the inserted string. Duplicate strings that get inserted will return the same byte offset.

Definition at line 258 of file DataFileCache.cpp.

References lldb_private::ConstString::GetLength(), m_next_offset, m_string_to_offset, and m_strings.

Referenced by NameToDIE::Encode(), and EncodeCStrMap().

◆ Encode()

bool ConstStringTable::Encode ( DataEncoder &  encoder)

Member Data Documentation

◆ m_next_offset

uint32_t lldb_private::ConstStringTable::m_next_offset = 1
private

Skip one byte to start the string table off with an empty string.

Definition at line 196 of file DataFileCache.h.

Referenced by Add().

◆ m_string_to_offset

llvm::DenseMap<ConstString, uint32_t> lldb_private::ConstStringTable::m_string_to_offset
private

Definition at line 194 of file DataFileCache.h.

Referenced by Add(), and Encode().

◆ m_strings

std::vector<ConstString> lldb_private::ConstStringTable::m_strings
private

Definition at line 193 of file DataFileCache.h.

Referenced by Add(), and Encode().


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