21 using namespace llvm::msf;
22 using namespace llvm::support;
23 using namespace llvm::support::endian;
24 using namespace llvm::pdb;
27 return Strings.insert(S);
36 return (NumStrings + 1) * 1.25;
39 uint32_t PDBStringTableBuilder::calculateHashTableSize()
const {
46 uint32_t PDBStringTableBuilder::calculateSerializedSize()
const {
49 Size += Strings.calculateSerializedSize();
50 Size += calculateHashTableSize();
55 void PDBStringTableBuilder::setStrings(
57 this->Strings = Strings;
65 H.
ByteSize = Strings.calculateSerializedSize();
73 if (
auto EC = Strings.commit(Writer))
85 std::vector<ulittle32_t> Buckets(BucketCount);
87 for (
auto &Pair : Strings) {
96 if (Buckets[Slot] != 0)
121 if (
auto EC = writeHeader(SectionWriter))
124 std::tie(SectionWriter, Writer) =
125 Writer.
split(Strings.calculateSerializedSize());
126 if (
auto EC = writeStrings(SectionWriter))
129 std::tie(SectionWriter, Writer) = Writer.
split(calculateHashTableSize());
130 if (
auto EC = writeHashTable(SectionWriter))
133 std::tie(SectionWriter, Writer) = Writer.
split(
sizeof(
uint32_t));
134 if (
auto EC = writeEpilogue(SectionWriter))
Error writeObject(const T &Obj)
Writes the object Obj to the underlying stream, as if by using memcpy.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Error writeArray(ArrayRef< T > Array)
Writes an array of objects of type T to the underlying stream, as if by using memcpy.
static uint32_t computeBucketCount(uint32_t NumStrings)
uint32_t hashStringV1(StringRef Str)
Provides write only access to a subclass of WritableBinaryStream.
Error writeInteger(T Value)
Write the the integer Value to the underlying stream in the specified endianness. ...
static ErrorSuccess success()
Create a success value.
Represents a read-write view of a CodeView string table.
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
Adapter to write values to a stream in a particular byte order.
uint32_t bytesRemaining() const
const uint32_t PDBStringTableSignature
std::pair< BinaryStreamWriter, BinaryStreamWriter > split(uint32_t Off) const
Splits the Writer into two Writers at a given offset.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Lightweight error class with error context and mandatory checking.
std::string Hash(const Unit &U)
StringRef - Represent a constant reference to a string, i.e.