52 "Expected string buffer size"));
57 NamesBuffer.assign(Buffer.
begin(), Buffer.
end());
59 return OffsetIndexMap.load(Stream);
73 if (
auto EC = OffsetIndexMap.commit(Writer))
82 + OffsetIndexMap.calculateSerializedLength();
97 auto Iter = OffsetIndexMap.find_as(Stream, HashTraits);
98 if (Iter == OffsetIndexMap.end())
100 StreamNo = (*Iter).second;
106 for (
const auto &Entry : OffsetIndexMap) {
107 StringRef Stream(NamesBuffer.data() + Entry.first);
108 Result.try_emplace(Stream, Entry.second);
116 NamesBuffer.push_back(
'\0');
This file defines the StringMap class.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Provides read only access to a subclass of BinaryStream.
Error readInteger(T &Dest)
Read an integer of the specified endianness into Dest and update the stream's offset.
Error readFixedString(StringRef &Dest, uint32_t Length)
Read a Length byte string into Dest.
Provides write only access to a subclass of WritableBinaryStream.
Error writeInteger(T Value)
Write the integer Value to the underlying stream in the specified endianness.
Error writeFixedString(StringRef Str)
Write the string Str to the underlying stream without a null terminator.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
StringRef - Represent a constant reference to a string, i.e.
void set(StringRef Stream, uint32_t StreamNo)
Error load(BinaryStreamReader &Stream)
StringMap< uint32_t > entries() const
Error commit(BinaryStreamWriter &Writer) const
uint32_t hashString(uint32_t Offset) const
uint32_t appendStringData(StringRef S)
bool get(StringRef Stream, uint32_t &StreamNo) const
StringRef getString(uint32_t Offset) const
uint32_t calculateSerializedLength() const
uint32_t hashStringV1(StringRef Str)
This is an optimization pass for GlobalISel generic memory operations.
void append_range(Container &C, Range &&R)
Wrapper function to append range R to container C.
Error joinErrors(Error E1, Error E2)
Concatenate errors.
NamedStreamMapTraits(NamedStreamMap &NS)
uint16_t hashLookupKey(StringRef S) const
uint32_t lookupKeyToStorageKey(StringRef S)
StringRef storageKeyToLookupKey(uint32_t Offset) const