File indexing completed on 2026-05-10 08:43:45
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef LLVM_DEBUGINFO_PDB_NATIVE_TPISTREAM_H
0010 #define LLVM_DEBUGINFO_PDB_NATIVE_TPISTREAM_H
0011
0012 #include "llvm/DebugInfo/CodeView/CVRecord.h"
0013 #include "llvm/DebugInfo/PDB/Native/HashTable.h"
0014 #include "llvm/DebugInfo/PDB/Native/RawConstants.h"
0015 #include "llvm/Support/BinaryStreamArray.h"
0016 #include "llvm/Support/BinaryStreamRef.h"
0017
0018 #include "llvm/Support/Error.h"
0019
0020 namespace llvm {
0021 class BinaryStream;
0022 namespace codeview {
0023 class TypeIndex;
0024 struct TypeIndexOffset;
0025 class LazyRandomTypeCollection;
0026 }
0027 namespace msf {
0028 class MappedBlockStream;
0029 }
0030 namespace pdb {
0031 struct TpiStreamHeader;
0032 class PDBFile;
0033
0034 class TpiStream {
0035 friend class TpiStreamBuilder;
0036
0037 public:
0038 TpiStream(PDBFile &File, std::unique_ptr<msf::MappedBlockStream> Stream);
0039 ~TpiStream();
0040 Error reload();
0041
0042 PdbRaw_TpiVer getTpiVersion() const;
0043
0044 uint32_t TypeIndexBegin() const;
0045 uint32_t TypeIndexEnd() const;
0046 uint32_t getNumTypeRecords() const;
0047 uint16_t getTypeHashStreamIndex() const;
0048 uint16_t getTypeHashStreamAuxIndex() const;
0049
0050 uint32_t getHashKeySize() const;
0051 uint32_t getNumHashBuckets() const;
0052 FixedStreamArray<support::ulittle32_t> getHashValues() const;
0053 FixedStreamArray<codeview::TypeIndexOffset> getTypeIndexOffsets() const;
0054 HashTable<support::ulittle32_t> &getHashAdjusters();
0055
0056 codeview::CVTypeRange types(bool *HadError) const;
0057 const codeview::CVTypeArray &typeArray() const { return TypeRecords; }
0058
0059 codeview::LazyRandomTypeCollection &typeCollection() { return *Types; }
0060
0061 Expected<codeview::TypeIndex>
0062 findFullDeclForForwardRef(codeview::TypeIndex ForwardRefTI) const;
0063
0064 std::vector<codeview::TypeIndex> findRecordsByName(StringRef Name) const;
0065
0066 codeview::CVType getType(codeview::TypeIndex Index);
0067
0068 BinarySubstreamRef getTypeRecordsSubstream() const;
0069
0070 Error commit();
0071
0072 void buildHashMap();
0073
0074 bool supportsTypeLookup() const;
0075
0076 private:
0077 PDBFile &Pdb;
0078 std::unique_ptr<msf::MappedBlockStream> Stream;
0079
0080 std::unique_ptr<codeview::LazyRandomTypeCollection> Types;
0081
0082 BinarySubstreamRef TypeRecordsSubstream;
0083
0084 codeview::CVTypeArray TypeRecords;
0085
0086 std::unique_ptr<BinaryStream> HashStream;
0087 FixedStreamArray<support::ulittle32_t> HashValues;
0088 FixedStreamArray<codeview::TypeIndexOffset> TypeIndexOffsets;
0089 HashTable<support::ulittle32_t> HashAdjusters;
0090
0091 std::vector<std::vector<codeview::TypeIndex>> HashMap;
0092
0093 const TpiStreamHeader *Header;
0094 };
0095 }
0096 }
0097
0098 #endif