LLVM: lib/DebugInfo/PDB/Native/PDBStringTable.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
10
16
17using namespace llvm;
20
25
27 if (auto EC = Reader.readObject(Header))
28 return EC;
29
32 "Invalid hash table signature");
33 if (Header->HashVersion != 1 && Header->HashVersion != 2)
35 "Unsupported hash version");
36
39}
40
44 return EC;
45
46 if (auto EC = Strings.initialize(Stream)) {
49 "Invalid hash table byte length"));
50 }
51
54}
55
56const codeview::DebugStringTableSubsectionRef &
60
63 if (auto EC = Reader.readObject(HashCount))
64 return EC;
65
66 if (auto EC = Reader.readArray(IDs, *HashCount)) {
69 "Could not read bucket array"));
70 }
71
73}
74
76 if (auto EC = Reader.readInteger(NameCount))
77 return EC;
78
81}
82
84
86
88 if (auto EC = readHeader(SectionReader))
89 return EC;
90
91 std::tie(SectionReader, Reader) = Reader.split(Header->ByteSize);
92 if (auto EC = readStrings(SectionReader))
93 return EC;
94
95
96
97 if (auto EC = readHashTable(Reader))
98 return EC;
99
100 std::tie(SectionReader, Reader) = Reader.split(sizeof(uint32_t));
101 if (auto EC = readEpilogue(SectionReader))
102 return EC;
103
106}
107
109 return Strings.getString(ID);
110}
111
115 size_t Count = IDs.size();
117 for (size_t I = 0; I < Count; ++I) {
118
119
120
122
123
125 if (ID == 0)
128 if (!ExpectedStr)
129 return ExpectedStr.takeError();
130
131 if (*ExpectedStr == Str)
132 return ID;
133 }
135}
136
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Provides read only access to a subclass of BinaryStream.
LLVM_ABI Error readStreamRef(BinaryStreamRef &Ref)
Read the entire remainder of the underlying stream into Ref.
Error readObject(const T *&Dest)
Get a pointer to an object of type T from the underlying stream, as if by memcpy, and store the resul...
Error readInteger(T &Dest)
Read an integer of the specified endianness into Dest and update the stream's offset.
uint64_t bytesRemaining() const
LLVM_ABI std::pair< BinaryStreamReader, BinaryStreamReader > split(uint64_t Offset) const
Error readArray(ArrayRef< T > &Array, uint32_t NumElements)
Get a reference to a NumElements element array of objects of type T from the underlying stream as if ...
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
FixedStreamArray is similar to VarStreamArray, except with each record having a fixed-length.
StringRef - Represent a constant reference to a string, i.e.
LLVM_ABI Error initialize(BinaryStreamRef Contents)
LLVM_ABI const codeview::DebugStringTableSubsectionRef & getStringTable() const
Definition PDBStringTable.cpp:57
LLVM_ABI uint32_t getSignature() const
Definition PDBStringTable.cpp:24
LLVM_ABI uint32_t getNameCount() const
Definition PDBStringTable.cpp:22
LLVM_ABI Expected< uint32_t > getIDForString(StringRef Str) const
Definition PDBStringTable.cpp:112
LLVM_ABI Error reload(BinaryStreamReader &Reader)
Definition PDBStringTable.cpp:83
LLVM_ABI Expected< StringRef > getStringForID(uint32_t ID) const
Definition PDBStringTable.cpp:108
LLVM_ABI uint32_t getByteSize() const
Definition PDBStringTable.cpp:21
LLVM_ABI uint32_t getHashVersion() const
Definition PDBStringTable.cpp:23
LLVM_ABI FixedStreamArray< support::ulittle32_t > name_ids() const
Definition PDBStringTable.cpp:137
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
LLVM_ABI uint32_t hashStringV1(StringRef Str)
const uint32_t PDBStringTableSignature
LLVM_ABI uint32_t hashStringV2(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.
Error joinErrors(Error E1, Error E2)
Concatenate errors.
FunctionAddr VTableAddr Count
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.