1 //===- TpiStream.cpp - PDB Type Info (TPI) Stream 2 Access ------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_DEBUGINFO_PDB_RAW_PDBTPISTREAM_H
10 #define LLVM_DEBUGINFO_PDB_RAW_PDBTPISTREAM_H
12 #include "llvm/DebugInfo/CodeView/TypeRecord.h"
13 #include "llvm/DebugInfo/PDB/Native/HashTable.h"
14 #include "llvm/DebugInfo/PDB/Native/RawConstants.h"
15 #include "llvm/DebugInfo/PDB/Native/RawTypes.h"
16 #include "llvm/DebugInfo/PDB/PDBTypes.h"
17 #include "llvm/Support/BinaryStreamArray.h"
18 #include "llvm/Support/BinaryStreamRef.h"
19 #include "llvm/Support/raw_ostream.h"
21 #include "llvm/Support/Error.h"
25 class LazyRandomTypeCollection
;
28 class MappedBlockStream
;
34 friend class TpiStreamBuilder
;
37 TpiStream(PDBFile
&File
, std::unique_ptr
<msf::MappedBlockStream
> Stream
);
41 PdbRaw_TpiVer
getTpiVersion() const;
43 uint32_t TypeIndexBegin() const;
44 uint32_t TypeIndexEnd() const;
45 uint32_t getNumTypeRecords() const;
46 uint16_t getTypeHashStreamIndex() const;
47 uint16_t getTypeHashStreamAuxIndex() const;
49 uint32_t getHashKeySize() const;
50 uint32_t getNumHashBuckets() const;
51 FixedStreamArray
<support::ulittle32_t
> getHashValues() const;
52 FixedStreamArray
<codeview::TypeIndexOffset
> getTypeIndexOffsets() const;
53 HashTable
<support::ulittle32_t
> &getHashAdjusters();
55 codeview::CVTypeRange
types(bool *HadError
) const;
56 const codeview::CVTypeArray
&typeArray() const { return TypeRecords
; }
58 codeview::LazyRandomTypeCollection
&typeCollection() { return *Types
; }
60 Expected
<codeview::TypeIndex
>
61 findFullDeclForForwardRef(codeview::TypeIndex ForwardRefTI
) const;
63 std::vector
<codeview::TypeIndex
> findRecordsByName(StringRef Name
) const;
65 codeview::CVType
getType(codeview::TypeIndex Index
);
67 BinarySubstreamRef
getTypeRecordsSubstream() const;
73 bool supportsTypeLookup() const;
77 std::unique_ptr
<msf::MappedBlockStream
> Stream
;
79 std::unique_ptr
<codeview::LazyRandomTypeCollection
> Types
;
81 BinarySubstreamRef TypeRecordsSubstream
;
83 codeview::CVTypeArray TypeRecords
;
85 std::unique_ptr
<BinaryStream
> HashStream
;
86 FixedStreamArray
<support::ulittle32_t
> HashValues
;
87 FixedStreamArray
<codeview::TypeIndexOffset
> TypeIndexOffsets
;
88 HashTable
<support::ulittle32_t
> HashAdjusters
;
90 std::vector
<std::vector
<codeview::TypeIndex
>> HashMap
;
92 const TpiStreamHeader
*Header
;