45 "TPI Stream does not contain a header.");
49 "TPI Stream does not contain a header.");
53 "Unsupported TPI Version.");
57 "Corrupt TPI Header size.");
61 "TPI Stream expected 4 byte hash key size.");
66 "TPI Stream Invalid number of hash buckets.");
75 RecordReader.
readArray(TypeRecords, TypeRecordsSubstream.
size()))
84 "Invalid TPI hash stream index.");
92 return make_error<RawError>(
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 = std::make_unique<LazyRandomTypeCollection>(
144 if (!HashMap.empty())
146 if (HashValues.
empty())
154 uint32_t HV = HashValues[TIB.toArrayIndex()];
155 HashMap[HV].push_back(TIB++);
164 if (Bucket > HashMap.size())
167 std::vector<TypeIndex> Result;
170 if (ThisName ==
Name)
171 Result.push_back(TI);
183 CVType F = Types->getType(ForwardRefTI);
193 for (
TypeIndex TI : HashMap[BucketIdx]) {
194 CVType CVT = Types->getType(TI);
195 if (CVT.
kind() !=
F.kind())
201 if (ForwardTRH->FullRecordHash != FullTRH->FullRecordHash)
203 TagRecord &ForwardTR = ForwardTRH->getRecord();
204 TagRecord &FullTR = FullTRH->getRecord();
221 assert(!Index.isSimple());
222 return Types->getType(Index);
226 return TypeRecordsSubstream;
234 return TypeIndexOffsets;
238 return HashAdjusters;
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Provides read only access to a subclass of BinaryStream.
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...
Error readSubstream(BinarySubstreamRef &Ref, uint32_t Length)
Read Length bytes from the underlying stream into Ref.
uint64_t bytesRemaining() const
void setOffset(uint64_t Off)
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 ...
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
Error takeError()
Take ownership of the stored error.
FixedStreamArray is similar to VarStreamArray, except with each record having a fixed-length.
StringRef - Represent a constant reference to a string, i.e.
LLVM Value Representation.
Iterator begin(bool *HadError=nullptr) const
StringRef getName() const
StringRef getUniqueName() const
bool hasUniqueName() const
A range adaptor for a pair of iterators.
Expected< std::unique_ptr< msf::MappedBlockStream > > safelyCreateIndexedStream(uint32_t StreamIndex) const
Wrapper around MappedBlockStream::createIndexedStream() that checks if a stream with that index actua...
uint32_t getHashKeySize() const
BinarySubstreamRef getTypeRecordsSubstream() const
HashTable< support::ulittle32_t > & getHashAdjusters()
std::vector< codeview::TypeIndex > findRecordsByName(StringRef Name) const
uint32_t TypeIndexBegin() const
PdbRaw_TpiVer getTpiVersion() const
codeview::CVTypeRange types(bool *HadError) const
TpiStream(PDBFile &File, std::unique_ptr< msf::MappedBlockStream > Stream)
FixedStreamArray< codeview::TypeIndexOffset > getTypeIndexOffsets() const
codeview::CVType getType(codeview::TypeIndex Index)
uint16_t getTypeHashStreamAuxIndex() const
uint16_t getTypeHashStreamIndex() const
bool supportsTypeLookup() const
FixedStreamArray< support::ulittle32_t > getHashValues() const
Expected< codeview::TypeIndex > findFullDeclForForwardRef(codeview::TypeIndex ForwardRefTI) const
uint32_t getNumTypeRecords() const
uint32_t TypeIndexEnd() const
uint32_t getNumHashBuckets() const
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
bool isUdtForwardRef(CVType CVT)
Given an arbitrary codeview type, determine if it is an LF_STRUCTURE, LF_CLASS, LF_INTERFACE,...
std::string computeTypeName(TypeCollection &Types, TypeIndex Index)
const uint16_t kInvalidStreamIndex
uint32_t hashStringV1(StringRef Str)
const uint32_t MaxTpiHashBuckets
const uint32_t MinTpiHashBuckets
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 ...
detail::packed_endian_specific_integral< uint32_t, llvm::endianness::little, unaligned > ulittle32_t
This is an optimization pass for GlobalISel generic memory operations.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
void consumeError(Error Err)
Consume a Error without doing anything.
Implement std::hash so that hash_code can be used in STL containers.
BinaryStreamRef StreamData