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
36
40
42 return NS->appendStringData(S);
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
91
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
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the StringMap class.
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.
LLVM_ABI 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.
LLVM_ABI 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.
LLVM_ABI void set(StringRef Stream, uint32_t StreamNo)
Definition NamedStreamMap.cpp:120
LLVM_ABI Error load(BinaryStreamReader &Stream)
Definition NamedStreamMap.cpp:47
LLVM_ABI StringMap< uint32_t > entries() const
Definition NamedStreamMap.cpp:104
LLVM_ABI NamedStreamMap()
Definition NamedStreamMap.cpp:45
LLVM_ABI Error commit(BinaryStreamWriter &Writer) const
Definition NamedStreamMap.cpp:62
LLVM_ABI uint32_t hashString(uint32_t Offset) const
Definition NamedStreamMap.cpp:92
LLVM_ABI uint32_t appendStringData(StringRef S)
Definition NamedStreamMap.cpp:113
LLVM_ABI bool get(StringRef Stream, uint32_t &StreamNo) const
Definition NamedStreamMap.cpp:96
LLVM_ABI StringRef getString(uint32_t Offset) const
Definition NamedStreamMap.cpp:87
LLVM_ABI uint32_t size() const
Definition NamedStreamMap.cpp:85
LLVM_ABI uint32_t calculateSerializedLength() const
Definition NamedStreamMap.cpp:79
LLVM_ABI uint32_t hashStringV1(StringRef Str)
detail::packed_endian_specific_integral< uint32_t, llvm::endianness::little, unaligned > ulittle32_t
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.
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
LLVM_ABI NamedStreamMapTraits(NamedStreamMap &NS)
Definition NamedStreamMap.cpp:25
LLVM_ABI uint16_t hashLookupKey(StringRef S) const
Definition NamedStreamMap.cpp:27
LLVM_ABI uint32_t lookupKeyToStorageKey(StringRef S)
Definition NamedStreamMap.cpp:41
LLVM_ABI StringRef storageKeyToLookupKey(uint32_t Offset) const
Definition NamedStreamMap.cpp:37