50 : HashTraits(*this), OffsetIndexMap(1, HashTraits) {}
57 "Expected string buffer size"));
62 NamesBuffer.assign(Buffer.
begin(), Buffer.
end());
64 return OffsetIndexMap.load(Stream);
78 if (
auto EC = OffsetIndexMap.commit(Writer))
87 + OffsetIndexMap.calculateSerializedLength();
102 auto Iter = OffsetIndexMap.find_as(Stream);
103 if (Iter == OffsetIndexMap.end())
105 StreamNo = (*Iter).second;
111 for (
const auto &Entry : OffsetIndexMap) {
112 StringRef Stream(NamesBuffer.data() + Entry.first);
120 NamesBuffer.insert(NamesBuffer.end(), S.
begin(), S.
end());
121 NamesBuffer.push_back(
'\0');
uint32_t calculateSerializedLength() const
uint32_t appendStringData(StringRef S)
This class represents lattice values for constants.
Error readInteger(T &Dest)
Read an integer of the specified endianness into Dest and update the stream's offset.
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
StringRef getString(uint32_t Offset) const
void set(StringRef Stream, uint32_t StreamNo)
StringRef storageKeyToLookupKey(uint32_t Offset) const
uint16_t hashLookupKey(StringRef S) const
uint32_t lookupKeyToStorageKey(StringRef S)
Error writeFixedString(StringRef Str)
Write the string Str to the underlying stream without a null terminator.
Error readFixedString(StringRef &Dest, uint32_t Length)
Read a Length byte string into Dest.
std::pair< iterator, bool > try_emplace(StringRef Key, ArgsTy &&... Args)
Emplace a new element for the specified key into the map if the key isn't already in the map...
Error load(BinaryStreamReader &Stream)
StringMap< uint32_t > entries() const
uint32_t hashStringV1(StringRef Str)
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.
uint32_t hashString(uint32_t Offset) const
Error commit(BinaryStreamWriter &Writer) const
static ErrorSuccess success()
Create a success value.
Error joinErrors(Error E1, Error E2)
Concatenate errors.
bool get(StringRef Stream, uint32_t &StreamNo) const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Lightweight error class with error context and mandatory checking.
Provides read only access to a subclass of BinaryStream.
StringRef - Represent a constant reference to a string, i.e.
NamedStreamMapTraits(NamedStreamMap &NS)