36 TpiStream::TpiStream(
PDBFile &
File, std::unique_ptr<MappedBlockStream> Stream)
37 :
Pdb(File), Stream(
std::move(Stream)) {}
46 "TPI Stream does not contain a header.");
49 return make_error<RawError>(raw_error_code::corrupt_file,
50 "TPI Stream does not contain a header.");
54 "Unsupported TPI Version.");
57 return make_error<RawError>(raw_error_code::corrupt_file,
58 "Corrupt TPI Header size.");
61 return make_error<RawError>(raw_error_code::corrupt_file,
62 "TPI Stream expected 4 byte hash key size.");
67 "TPI Stream Invalid number of hash buckets.");
76 RecordReader.
readArray(TypeRecords, TypeRecordsSubstream.
size()))
85 "Invalid TPI hash stream index.");
93 return make_error<RawError>(
94 raw_error_code::corrupt_file,
95 "TPI hash count does not match with the number of type records.");
97 if (
auto EC = HSR.readArray(HashValues, NumHashValues))
103 if (
auto EC = HSR.readArray(TypeIndexOffsets, NumTypeIndexOffsets))
108 if (
auto EC = HashAdjusters.load(HSR))
112 HashStream = std::move(*
HS);
115 Types = std::make_unique<LazyRandomTypeCollection>(
145 if (!HashMap.empty())
147 if (HashValues.
empty())
155 uint32_t HV = HashValues[TIB.toArrayIndex()];
156 HashMap[HV].push_back(TIB++);
165 if (Bucket > HashMap.size())
168 std::vector<TypeIndex> Result;
171 if (ThisName == Name)
172 Result.push_back(TI);
184 CVType F = Types->getType(ForwardRefTI);
194 for (
TypeIndex TI : HashMap[BucketIdx]) {
195 CVType CVT = Types->getType(TI);
202 if (ForwardTRH->FullRecordHash != FullTRH->FullRecordHash)
204 TagRecord &ForwardTR = ForwardTRH->getRecord();
205 TagRecord &FullTR = FullTRH->getRecord();
223 return Types->getType(Index);
227 return TypeRecordsSubstream;
235 return TypeIndexOffsets;
239 return HashAdjusters;
This class represents lattice values for constants.
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
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
StringRef getName() const
bool hasUniqueName() const
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 ...
Expected< std::unique_ptr< msf::MappedBlockStream > > safelyCreateIndexedStream(uint32_t StreamIndex) const
Wrapper around MappedBlockStream::createIndexedStream() that checks if a stream with that index actua...
codeview::CVTypeRange types(bool *HadError) const
const uint16_t kInvalidStreamIndex
uint32_t hashStringV1(StringRef Str)
detail::packed_endian_specific_integral< uint32_t, little, unaligned > ulittle32_t
Instrumentation for Order File
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
void consumeError(Error Err)
Consume a Error without doing anything.
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
Error readSubstream(BinarySubstreamRef &Ref, uint32_t Length)
Read Length bytes from the underlying stream into Ref.
uint16_t getTypeHashStreamIndex() const
uint32_t bytesRemaining() const
uint32_t getNumTypeRecords() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
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