53 "Expected string buffer size"));
58 NamesBuffer.assign(Buffer.
begin(), Buffer.
end());
60 return OffsetIndexMap.load(Stream);
74 if (
auto EC = OffsetIndexMap.commit(Writer))
83 + OffsetIndexMap.calculateSerializedLength();
98 auto Iter = OffsetIndexMap.find_as(Stream, HashTraits);
99 if (Iter == OffsetIndexMap.end())
101 StreamNo = (*Iter).second;
107 for (
const auto &Entry : OffsetIndexMap) {
108 StringRef Stream(NamesBuffer.data() + Entry.first);
109 Result.try_emplace(Stream, Entry.second);
117 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