|
LLVM
4.0.0
|
Utility for building string tables with deduplicated suffixes. More...
#include <StringTableBuilder.h>
Public Types | |
| enum | Kind { ELF, WinCOFF, MachO, RAW } |
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 21 of file StringTableBuilder.h.
| Enumerator | |
|---|---|
| ELF | |
| WinCOFF | |
| MachO | |
| RAW | |
Definition at line 23 of file StringTableBuilder.h.
Definition at line 42 of file StringTableBuilder.cpp.
| StringTableBuilder::~StringTableBuilder | ( | ) |
Definition at line 21 of file StringTableBuilder.cpp.
| 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 172 of file StringTableBuilder.cpp.
References llvm::alignTo(), assert(), llvm::COFF::NameSize, P, RAW, llvm::CachedHashStringRef::size(), and WinCOFF.
|
inline |
| void StringTableBuilder::clear | ( | ) |
Definition at line 160 of file StringTableBuilder.cpp.
| void StringTableBuilder::finalize | ( | ) |
Analyze the strings and build the final table.
No more strings can be added after this point.
Definition at line 110 of file StringTableBuilder.cpp.
| void StringTableBuilder::finalizeInOrder | ( | ) |
Finalize the string table without reording it.
In this mode, offsets returned by add will still be valid.
Definition at line 114 of file StringTableBuilder.cpp.
| 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 165 of file StringTableBuilder.cpp.
Referenced by getOffset().
|
inline |
Definition at line 56 of file StringTableBuilder.h.
References getOffset().
|
inline |
Definition at line 60 of file StringTableBuilder.h.
Referenced by write().
| void StringTableBuilder::write | ( | raw_ostream & | OS | ) | const |
Definition at line 47 of file StringTableBuilder.cpp.
References assert(), getSize(), and llvm::SmallVectorImpl< char >::resize().
| void StringTableBuilder::write | ( | uint8_t * | Buf | ) | const |
Definition at line 57 of file StringTableBuilder.cpp.
References assert(), llvm::StringRef::data(), llvm::StringRef::empty(), P, llvm::StringRef::size(), WinCOFF, and llvm::support::endian::write32le().
1.8.6