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>

Public Member Functions

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

Private Attributes

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

Detailed Description

Many cache files require string tables to store data efficiently.

This class helps create string tables.

Definition at line 181 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 266 of file DataFileCache.cpp.

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

Referenced by lldb_private::Mangled::Encode(), lldb_private::plugin::dwarf::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 207 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 205 of file DataFileCache.h.

Referenced by Add(), and Encode().

◆ m_strings

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

Definition at line 204 of file DataFileCache.h.

Referenced by Add(), and Encode().


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