1 //===- TpiStream.cpp - PDB Type Info (TPI) Stream 2 Access ------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_DEBUGINFO_PDB_RAW_PDBTPISTREAM_H
11 #define LLVM_DEBUGINFO_PDB_RAW_PDBTPISTREAM_H
13 #include "llvm/DebugInfo/CodeView/TypeRecord.h"
14 #include "llvm/DebugInfo/PDB/Native/HashTable.h"
15 #include "llvm/DebugInfo/PDB/Native/RawConstants.h"
16 #include "llvm/DebugInfo/PDB/Native/RawTypes.h"
17 #include "llvm/DebugInfo/PDB/PDBTypes.h"
18 #include "llvm/Support/BinaryStreamArray.h"
19 #include "llvm/Support/BinaryStreamRef.h"
20 #include "llvm/Support/raw_ostream.h"
22 #include "llvm/Support/Error.h"
26 class LazyRandomTypeCollection;
29 class MappedBlockStream;
35 friend class TpiStreamBuilder;
38 TpiStream(PDBFile &File, std::unique_ptr<msf::MappedBlockStream> Stream);
42 PdbRaw_TpiVer getTpiVersion() const;
44 uint32_t TypeIndexBegin() const;
45 uint32_t TypeIndexEnd() const;
46 uint32_t getNumTypeRecords() const;
47 uint16_t getTypeHashStreamIndex() const;
48 uint16_t getTypeHashStreamAuxIndex() const;
50 uint32_t getHashKeySize() const;
51 uint32_t getNumHashBuckets() const;
52 FixedStreamArray<support::ulittle32_t> getHashValues() const;
53 FixedStreamArray<codeview::TypeIndexOffset> getTypeIndexOffsets() const;
54 HashTable<support::ulittle32_t> &getHashAdjusters();
56 codeview::CVTypeRange types(bool *HadError) const;
57 const codeview::CVTypeArray &typeArray() const { return TypeRecords; }
59 codeview::LazyRandomTypeCollection &typeCollection() { return *Types; }
61 Expected<codeview::TypeIndex>
62 findFullDeclForForwardRef(codeview::TypeIndex ForwardRefTI) const;
64 std::vector<codeview::TypeIndex> findRecordsByName(StringRef Name) const;
66 codeview::CVType getType(codeview::TypeIndex Index);
68 BinarySubstreamRef getTypeRecordsSubstream() const;
74 bool supportsTypeLookup() const;
78 std::unique_ptr<msf::MappedBlockStream> Stream;
80 std::unique_ptr<codeview::LazyRandomTypeCollection> Types;
82 BinarySubstreamRef TypeRecordsSubstream;
84 codeview::CVTypeArray TypeRecords;
86 std::unique_ptr<BinaryStream> HashStream;
87 FixedStreamArray<support::ulittle32_t> HashValues;
88 FixedStreamArray<codeview::TypeIndexOffset> TypeIndexOffsets;
89 HashTable<support::ulittle32_t> HashAdjusters;
91 std::vector<std::vector<codeview::TypeIndex>> HashMap;
93 const TpiStreamHeader *Header;