30 using namespace llvm::codeview;
31 using namespace llvm::support;
32 using namespace llvm::msf;
33 using namespace llvm::pdb;
36 std::unique_ptr<MappedBlockStream> Stream)
37 : Pdb(File), Stream(std::move(Stream)) {}
43 Error TpiStream::verifyHashValues() {
52 return Visitor.visitTypeStream(TypeRecords);
60 "TPI Stream does not contain a header.");
63 return make_error<RawError>(raw_error_code::corrupt_file,
64 "TPI Stream does not contain a header.");
68 "Unsupported TPI Version.");
71 return make_error<RawError>(raw_error_code::corrupt_file,
72 "Corrupt TPI Header size.");
75 return make_error<RawError>(raw_error_code::corrupt_file,
76 "TPI Stream expected 4 byte hash key size.");
81 "TPI Stream Invalid number of hash buckets.");
90 return make_error<RawError>(raw_error_code::corrupt_file,
91 "Invalid TPI hash stream index.");
93 auto HS = MappedBlockStream::createIndexedStream(
100 return make_error<RawError>(
101 raw_error_code::corrupt_file,
102 "TPI hash count does not match with the number of type records.");
104 if (
auto EC = HSR.readArray(HashValues, NumHashValues))
106 std::vector<ulittle32_t> HashValueList;
107 for (
auto I : HashValues)
108 HashValueList.push_back(
I);
113 if (
auto EC = HSR.readArray(TypeIndexOffsets, NumTypeIndexOffsets))
119 if (
auto EC = HSR.readArray(HashAdjustments, NumHashAdjustments))
122 HashStream = std::move(
HS);
126 if (
auto EC = verifyHashValues())
164 return TypeIndexOffsets;
169 return HashAdjustments;
msf::FixedStreamArray< support::ulittle32_t > getHashValues() const
msf::FixedStreamArray< TypeIndexOffset > getHashAdjustments() const
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
uint32_t getNumStreams() const override
iterator_range< codeview::CVTypeArray::Iterator > types(bool *HadError) const
Iterator begin(bool *HadError=nullptr) const
const uint16_t kInvalidStreamIndex
uint16_t getTypeHashStreamIndex() const
Error readArray(ArrayRef< T > &Array, uint32_t NumElements)
const msf::ReadableStream & getMsfBuffer() const
const msf::MSFLayout & getMsfLayout() const
uint32_t getHashKeySize() const
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.
msf::FixedStreamArray< TypeIndexOffset > getTypeIndexOffsets() const
A range adaptor for a pair of iterators.
uint16_t getTypeHashStreamAuxIndex() const
uint32_t NumHashBuckets() const
PdbRaw_TpiVer getTpiVersion() const
uint32_t bytesRemaining() const
detail::packed_endian_specific_integral< uint32_t, little, unaligned > ulittle32_t
LLVM Value Representation.
Lightweight error class with error context and mandatory checking.
uint32_t NumTypeRecords() const
uint32_t TypeIndexBegin() const
const uint32_t MaxTpiHashBuckets
Error readObject(const T *&Dest)
void addCallbackToPipeline(TypeVisitorCallbacks &Callbacks)