LLVM: lib/DebugInfo/PDB/Native/NamedStreamMap.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
19#include
20#include
21
22using namespace llvm;
24
26
28
29
30
31
32
33
35}
36
39}
40
43}
44
46
49 if (auto EC = Stream.readInteger(StringBufferSize))
52 "Expected string buffer size"));
53
55 if (auto EC = Stream.readFixedString(Buffer, StringBufferSize))
56 return EC;
57 NamesBuffer.assign(Buffer.begin(), Buffer.end());
58
59 return OffsetIndexMap.load(Stream);
60}
61
63
65 return EC;
66
67
68 StringRef Data(NamesBuffer.data(), NamesBuffer.size());
70 return EC;
71
72
73 if (auto EC = OffsetIndexMap.commit(Writer))
74 return EC;
75
77}
78
80 return sizeof(uint32_t)
81 + NamesBuffer.size()
82 + OffsetIndexMap.calculateSerializedLength();
83}
84
86
90}
91
94}
95
97 auto Iter = OffsetIndexMap.find_as(Stream, HashTraits);
98 if (Iter == OffsetIndexMap.end())
99 return false;
100 StreamNo = (*Iter).second;
101 return true;
102}
103
106 for (const auto &Entry : OffsetIndexMap) {
107 StringRef Stream(NamesBuffer.data() + Entry.first);
108 Result.try_emplace(Stream, Entry.second);
109 }
110 return Result;
111}
112
116 NamesBuffer.push_back('\0');
118}
119
122}
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