LLVM: llvm::StringTableBuilder Class Reference (original) (raw)

Utility for building string tables with deduplicated suffixes. More...

#include "[llvm/MC/StringTableBuilder.h](StringTableBuilder%5F8h%5Fsource.html)"

Public Types
enum Kind { ELF, WinCOFF, MachO, MachO64, MachOLinked, MachO64Linked, RAW, DWARF, XCOFF, DXContainer }
Public Member Functions
LLVM_ABI StringTableBuilder (Kind K, Align Alignment=Align(1))
LLVM_ABI ~StringTableBuilder ()
LLVM_ABI size_t add (CachedHashStringRef S, uint8_t Priority=0)
Add a string to the builder.
size_t add (StringRef S, uint8_t Priority=0)
LLVM_ABI void finalize ()
Analyze the strings and build the final table.
LLVM_ABI void finalizeInOrder ()
Finalize the string table without reording it.
LLVM_ABI size_t getOffset (CachedHashStringRef S) const
Get the offest of a string in the string table.
size_t getOffset (StringRef S) const
bool contains (StringRef S) const
Check if a string is contained in the string table.
bool contains (CachedHashStringRef S) const
bool empty () const
size_t getSize () const
LLVM_ABI void clear ()
LLVM_ABI void write (raw_ostream &OS) const
LLVM_ABI void write (uint8_t *Buf) const
bool isFinalized () const

Utility for building string tables with deduplicated suffixes.

Definition at line 25 of file StringTableBuilder.h.

Kind

Enumerator
ELF
WinCOFF
MachO
MachO64
MachOLinked
MachO64Linked
RAW
DWARF
XCOFF
DXContainer

Definition at line 27 of file StringTableBuilder.h.

StringTableBuilder::StringTableBuilder ( Kind K,
Align Alignment = Align(1) )

~StringTableBuilder()

StringTableBuilder::~StringTableBuilder ( ) default

add() [1/2]

Add a string to the builder.

Returns the position of S in the table. The position will be changed if finalize is used. Can only be used before the table is finalized. Priority is only useful with reordering. Strings with the same priority will be put together. Strings with higher priority are placed closer to the begin of string table. When adding same string with different priority, the maximum priority win.

Definition at line 220 of file StringTableBuilder.cpp.

References llvm::alignTo(), assert(), isFinalized(), llvm::COFF::NameSize, P, RAW, llvm::CachedHashStringRef::size(), and WinCOFF.

Referenced by add(), ProcessElementList(), llvm::mcdxbc::Signature::write(), llvm::object::OffloadBinary::write(), writeTypeIdCompatibleVtableSummaryRecord(), writeTypeIdSummaryRecord(), and writeWholeProgramDevirtResolution().

add() [2/2]

clear()

void StringTableBuilder::clear ( )

contains() [1/2]

contains() [2/2]

bool llvm::StringTableBuilder::contains ( StringRef S) const inline

Check if a string is contained in the string table.

Since this class doesn't store the string values, this function can be used to check if storage needs to be done prior to adding the string.

Definition at line 85 of file StringTableBuilder.h.

References contains().

Referenced by contains().

empty()

bool llvm::StringTableBuilder::empty ( ) const inline

finalize()

void StringTableBuilder::finalize ( )

finalizeInOrder()

void StringTableBuilder::finalizeInOrder ( )

getOffset() [1/2]

getOffset() [2/2]

size_t llvm::StringTableBuilder::getOffset ( StringRef S) const inline

getSize()

size_t llvm::StringTableBuilder::getSize ( ) const inline

isFinalized()

bool llvm::StringTableBuilder::isFinalized ( ) const inline

write() [1/2]

void StringTableBuilder::write ( raw_ostream & OS ) const

Definition at line 61 of file StringTableBuilder.cpp.

References assert(), llvm::Data, getSize(), isFinalized(), and write().

Referenced by upgrade(), llvm::objcopy:🧝:IHexSectionWriter::visit(), llvm::objcopy:🧝:SectionWriter::visit(), llvm::objcopy:🧝:SRECSectionWriter::visit(), llvm::mcdxbc::Signature::write(), llvm::object::OffloadBinary::write(), and write().

write() [2/2]

void StringTableBuilder::write ( uint8_t * Buf ) const

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