29 using namespace llvm::codeview;
30 using namespace llvm::support;
31 using namespace llvm::msf;
32 using namespace llvm::pdb;
34 TpiStream::TpiStream(
PDBFile &
File, std::unique_ptr<MappedBlockStream> Stream)
35 :
Pdb(File), Stream(std::move(Stream)) {}
44 "TPI Stream does not contain a header.");
47 return make_error<RawError>(raw_error_code::corrupt_file,
48 "TPI Stream does not contain a header.");
52 "Unsupported TPI Version.");
55 return make_error<RawError>(raw_error_code::corrupt_file,
56 "Corrupt TPI Header size.");
59 return make_error<RawError>(raw_error_code::corrupt_file,
60 "TPI Stream expected 4 byte hash key size.");
65 "TPI Stream Invalid number of hash buckets.");
74 RecordReader.
readArray(TypeRecords, TypeRecordsSubstream.
size()))
80 return make_error<RawError>(raw_error_code::corrupt_file,
81 "Invalid TPI hash stream index.");
83 auto HS = MappedBlockStream::createIndexedStream(
92 return make_error<RawError>(
93 raw_error_code::corrupt_file,
94 "TPI hash count does not match with the number of type records.");
96 if (
auto EC = HSR.readArray(HashValues, NumHashValues))
102 if (
auto EC = HSR.readArray(TypeIndexOffsets, NumTypeIndexOffsets))
107 if (
auto EC = HashAdjusters.
load(HSR))
111 HashStream = std::move(
HS);
114 Types = llvm::make_unique<LazyRandomTypeCollection>(
144 return TypeRecordsSubstream;
152 return TypeIndexOffsets;
FixedStreamArray< support::ulittle32_t > getHashValues() const
Error readSubstream(BinarySubstreamRef &Stream, uint32_t Size)
Read Length bytes from the underlying stream into Stream.
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
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...
uint32_t getNumStreams() const override
HashTable & getHashAdjusters()
const uint16_t kInvalidStreamIndex
BumpPtrAllocator & getAllocator()
uint32_t bytesRemaining() const
detail::packed_endian_specific_integral< uint32_t, little, unaligned > ulittle32_t
uint16_t getTypeHashStreamIndex() const
const msf::MSFLayout & getMsfLayout() const
uint32_t getHashKeySize() const
Error load(BinaryStreamReader &Stream)
BinaryStreamRef StreamData
const uint32_t MinTpiHashBuckets
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
uint32_t TypeIndexEnd() const
static ErrorSuccess success()
Create a success value.
FixedStreamArray< codeview::TypeIndexOffset > getTypeIndexOffsets() const
A range adaptor for a pair of iterators.
uint16_t getTypeHashStreamAuxIndex() const
BinarySubstreamRef getTypeRecordsSubstream() const
BinaryStreamRef getMsfBuffer() const
PdbRaw_TpiVer getTpiVersion() const
uint32_t getNumHashBuckets() const
uint32_t getNumTypeRecords() const
LLVM Value Representation.
Lightweight error class with error context and mandatory checking.
Iterator begin(bool *HadError=nullptr) const
Provides read only access to a subclass of BinaryStream.
codeview::CVTypeRange types(bool *HadError) const
uint32_t TypeIndexBegin() const
const uint32_t MaxTpiHashBuckets
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 ...