|
LLVM
10.0.0
|
Utility for building string tables with deduplicated suffixes. More...
#include "llvm/MC/StringTableBuilder.h"
Public Types | |
| enum | Kind { ELF, WinCOFF, MachO, RAW, DWARF, XCOFF } |
Public Member Functions | |
| StringTableBuilder (Kind K, unsigned Alignment=1) | |
| ~StringTableBuilder () | |
| size_t | add (CachedHashStringRef S) |
| Add a string to the builder. More... | |
| size_t | add (StringRef S) |
| void | finalize () |
| Analyze the strings and build the final table. More... | |
| void | finalizeInOrder () |
| Finalize the string table without reording it. More... | |
| size_t | getOffset (CachedHashStringRef S) const |
| Get the offest of a string in the string table. More... | |
| size_t | getOffset (StringRef S) const |
| size_t | getSize () const |
| void | clear () |
| void | write (raw_ostream &OS) const |
| void | write (uint8_t *Buf) const |
Utility for building string tables with deduplicated suffixes.
Definition at line 23 of file StringTableBuilder.h.
| Enumerator | |
|---|---|
| ELF | |
| WinCOFF | |
| MachO | |
| RAW | |
| DWARF | |
| XCOFF | |
Definition at line 25 of file StringTableBuilder.h.
Definition at line 49 of file StringTableBuilder.cpp.
|
default |
| size_t StringTableBuilder::add | ( | CachedHashStringRef | S | ) |
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.
Definition at line 187 of file StringTableBuilder.cpp.
References assert(), llvm::COFF::NameSize, P, llvm::CachedHashStringRef::size(), and WinCOFF.
Referenced by llvm::MachObjectWriter::computeSymbolTable(), llvm::MCDwarfLineStr::emitRef(), getEncodedUnnamedAddr(), llvm::gsym::GsymCreator::insertString(), llvm::WriteIndexToFile(), writeTypeIdCompatibleVtableSummaryRecord(), writeTypeIdSummaryRecord(), and writeWholeProgramDevirtResolution().
Definition at line 45 of file StringTableBuilder.h.
References add(), finalize(), finalizeInOrder(), and getOffset().
Referenced by add().
| void StringTableBuilder::clear | ( | ) |
Definition at line 175 of file StringTableBuilder.cpp.
Referenced by getSize(), and llvm::MachObjectWriter::reset().
| void StringTableBuilder::finalize | ( | ) |
Analyze the strings and build the final table.
No more strings can be added after this point.
Definition at line 122 of file StringTableBuilder.cpp.
References assert(), and DWARF.
Referenced by add(), and llvm::MachObjectWriter::computeSymbolTable().
| void StringTableBuilder::finalizeInOrder | ( | ) |
Finalize the string table without reording it.
In this mode, offsets returned by add will still be valid.
Definition at line 127 of file StringTableBuilder.cpp.
Referenced by add(), llvm::MCDwarfLineStr::emitSection(), llvm::gsym::GsymCreator::finalize(), and llvm::BitcodeWriter::writeStrtab().
| size_t StringTableBuilder::getOffset | ( | CachedHashStringRef | S | ) | const |
Get the offest of a string in the string table.
Can only be used after the table is finalized.
Definition at line 180 of file StringTableBuilder.cpp.
Referenced by add(), llvm::MachObjectWriter::computeSymbolTable(), getOffset(), and writeContent().
Definition at line 58 of file StringTableBuilder.h.
References getOffset().
|
inline |
Definition at line 62 of file StringTableBuilder.h.
References clear(), and write().
Referenced by llvm::MCDwarfLineStr::emitSection(), write(), writeContent(), llvm::MachObjectWriter::writeObject(), and llvm::BitcodeWriter::writeStrtab().
| void StringTableBuilder::write | ( | raw_ostream & | OS | ) | const |
Definition at line 54 of file StringTableBuilder.cpp.
References assert(), llvm::Data, llvm::SmallVectorTemplateCommon< T >::data(), getSize(), and llvm::SmallVectorImpl< char >::resize().
Referenced by llvm::MCDwarfLineStr::emitSection(), getSize(), writeContent(), and llvm::BitcodeWriter::writeStrtab().
| void StringTableBuilder::write | ( | uint8_t * | Buf | ) | const |
Definition at line 64 of file StringTableBuilder.cpp.
References assert(), llvm::Data, llvm::StringRef::data(), llvm::StringRef::empty(), P, llvm::StringRef::size(), WinCOFF, llvm::support::endian::write32be(), llvm::support::endian::write32le(), and XCOFF.
1.8.13