21 using namespace llvm::support;
22 using namespace llvm::pdb;
24 uint32_t PDBStringTable::getByteSize()
const {
return Header->ByteSize; }
25 uint32_t PDBStringTable::getNameCount()
const {
return NameCount; }
26 uint32_t PDBStringTable::getHashVersion()
const {
return Header->HashVersion; }
34 return make_error<RawError>(raw_error_code::corrupt_file,
35 "Invalid hash table signature");
36 if (Header->HashVersion != 1 && Header->HashVersion != 2)
37 return make_error<RawError>(raw_error_code::corrupt_file,
38 "Unsupported hash version");
49 if (
auto EC = Strings.initialize(Stream)) {
51 make_error<RawError>(raw_error_code::corrupt_file,
52 "Invalid hash table byte length"));
60 PDBStringTable::getStringTable()
const {
69 if (
auto EC = Reader.
readArray(IDs, *HashCount)) {
71 make_error<RawError>(raw_error_code::corrupt_file,
72 "Could not read bucket array"));
91 if (
auto EC = readHeader(SectionReader))
94 std::tie(SectionReader, Reader) = Reader.
split(Header->ByteSize);
95 if (
auto EC = readStrings(SectionReader))
100 if (
auto EC = readHashTable(Reader))
103 std::tie(SectionReader, Reader) = Reader.
split(
sizeof(
uint32_t));
104 if (
auto EC = readEpilogue(SectionReader))
112 return Strings.getString(ID);
118 size_t Count = IDs.size();
120 for (
size_t I = 0;
I < Count; ++
I) {
127 auto ExpectedStr = getStringForID(ID);
129 return ExpectedStr.takeError();
131 if (*ExpectedStr == Str)
134 return make_error<RawError>(raw_error_code::no_entry);
uint32_t hashStringV2(StringRef Str)
Error readInteger(T &Dest)
Read an integer of the specified endianness into Dest and update the stream's offset.
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...
Tagged union holding either a T or a Error.
uint32_t bytesRemaining() const
uint32_t hashStringV1(StringRef Str)
std::pair< BinaryStreamReader, BinaryStreamReader > split(uint32_t Offset) const
static ErrorSuccess success()
Create a success value.
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.
Represents a read-only view of a CodeView string table.
Error joinErrors(Error E1, Error E2)
Concatenate errors.
Error readStreamRef(BinaryStreamRef &Ref)
Read the entire remainder of the underlying stream into Ref.
const uint32_t PDBStringTableSignature
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Lightweight error class with error context and mandatory checking.
std::string Hash(const Unit &U)
Provides read only access to a subclass of BinaryStream.
StringRef - Represent a constant reference to a string, i.e.
static std::string getSignature(FunctionType *FTy)
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 ...