37 TpiStream::TpiStream(
PDBFile &
File, std::unique_ptr<MappedBlockStream> Stream)
38 :
Pdb(File), Stream(
std::move(Stream)) {}
47 "TPI Stream does not contain a header.");
50 return make_error<RawError>(raw_error_code::corrupt_file,
51 "TPI Stream does not contain a header.");
55 "Unsupported TPI Version.");
58 return make_error<RawError>(raw_error_code::corrupt_file,
59 "Corrupt TPI Header size.");
62 return make_error<RawError>(raw_error_code::corrupt_file,
63 "TPI Stream expected 4 byte hash key size.");
68 "TPI Stream Invalid number of hash buckets.");
77 RecordReader.
readArray(TypeRecords, TypeRecordsSubstream.
size()))
83 return make_error<RawError>(raw_error_code::corrupt_file,
84 "Invalid TPI hash stream index.");
86 auto HS = MappedBlockStream::createIndexedStream(
95 return make_error<RawError>(
96 raw_error_code::corrupt_file,
97 "TPI hash count does not match with the number of type records.");
99 if (
auto EC = HSR.readArray(HashValues, NumHashValues))
105 if (
auto EC = HSR.readArray(TypeIndexOffsets, NumTypeIndexOffsets))
110 if (
auto EC = HashAdjusters.load(HSR))
114 HashStream = std::move(
HS);
117 Types = llvm::make_unique<LazyRandomTypeCollection>(
147 if (!HashMap.empty())
149 if (HashValues.
empty())
157 uint32_t HV = HashValues[TIB.toArrayIndex()];
158 HashMap[HV].push_back(TIB++);
167 if (Bucket > HashMap.size())
170 std::vector<TypeIndex> Result;
173 if (ThisName == Name)
174 Result.push_back(TI);
186 CVType F = Types->getType(ForwardRefTI);
196 for (
TypeIndex TI : HashMap[BucketIdx]) {
197 CVType CVT = Types->getType(TI);
204 if (ForwardTRH->FullRecordHash != FullTRH->FullRecordHash)
206 TagRecord &ForwardTR = ForwardTRH->getRecord();
207 TagRecord &FullTR = FullTRH->getRecord();
225 return Types->getType(Index);
229 return TypeRecordsSubstream;
237 return TypeIndexOffsets;
241 return HashAdjusters;
Error readSubstream(BinarySubstreamRef &Stream, uint32_t Size)
Read Length bytes from the underlying stream into Stream.
This class represents lattice values for constants.
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...
FixedStreamArray< support::ulittle32_t > getHashValues() const
std::string computeTypeName(TypeCollection &Types, TypeIndex Index)
Error takeError()
Take ownership of the stored error.
bool isUdtForwardRef(CVType CVT)
Given an arbitrary codeview type, determine if it is an LF_STRUCTURE, LF_CLASS, LF_INTERFACE, LF_UNION, or LF_ENUM with the forward ref class option.
uint32_t TypeIndexBegin() const
uint32_t getNumStreams() const override
StringRef getName() const
bool hasUniqueName() const
amdgpu Simplify well known AMD library false Value Value const Twine & Name
HashTable< support::ulittle32_t > & getHashAdjusters()
Tagged union holding either a T or a Error.
PdbRaw_TpiVer getTpiVersion() const
Expected< TagRecordHash > hashTagRecord(const codeview::CVType &Type)
Given a CVType referring to a class, structure, union, or enum, compute the hash of its forward decl ...
BinaryStreamRef getMsfBuffer() const
codeview::CVTypeRange types(bool *HadError) const
const uint16_t kInvalidStreamIndex
BumpPtrAllocator & getAllocator()
uint32_t hashStringV1(StringRef Str)
detail::packed_endian_specific_integral< uint32_t, little, unaligned > ulittle32_t
StringRef getUniqueName() const
codeview::CVType getType(codeview::TypeIndex Index)
BinarySubstreamRef getTypeRecordsSubstream() const
Expected< codeview::TypeIndex > findFullDeclForForwardRef(codeview::TypeIndex ForwardRefTI) const
uint32_t getHashKeySize() const
bool supportsTypeLookup() const
uint16_t getTypeHashStreamAuxIndex() const
BinaryStreamRef StreamData
const uint32_t MinTpiHashBuckets
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
static ErrorSuccess success()
Create a success value.
std::vector< codeview::TypeIndex > findRecordsByName(StringRef Name) const
A range adaptor for a pair of iterators.
uint32_t TypeIndexEnd() const
uint16_t getTypeHashStreamIndex() const
uint32_t bytesRemaining() const
uint32_t getNumTypeRecords() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const msf::MSFLayout & getMsfLayout() const
Iterator begin(bool *HadError=nullptr) const
LLVM Value Representation.
Lightweight error class with error context and mandatory checking.
Provides read only access to a subclass of BinaryStream.
StringRef - Represent a constant reference to a string, i.e.
uint32_t getNumHashBuckets() 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 ...
FixedStreamArray< codeview::TypeIndexOffset > getTypeIndexOffsets() const