LLVM 20.0.0git
TpiStream.h
Go to the documentation of this file.
1//===- TpiStream.cpp - PDB Type Info (TPI) Stream 2 Access ------*- C++ -*-===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_DEBUGINFO_PDB_NATIVE_TPISTREAM_H
10#define LLVM_DEBUGINFO_PDB_NATIVE_TPISTREAM_H
11
17
18#include "llvm/Support/Error.h"
19
20namespace llvm {
21class BinaryStream;
22namespace codeview {
23class TypeIndex;
24struct TypeIndexOffset;
25class LazyRandomTypeCollection;
26}
27namespace msf {
28class MappedBlockStream;
29}
30namespace pdb {
31struct TpiStreamHeader;
32class PDBFile;
33
34class TpiStream {
35 friend class TpiStreamBuilder;
36
37public:
38 TpiStream(PDBFile &File, std::unique_ptr<msf::MappedBlockStream> Stream);
40 Error reload();
41
43
45 uint32_t TypeIndexEnd() const;
49
55
56 codeview::CVTypeRange types(bool *HadError) const;
57 const codeview::CVTypeArray &typeArray() const { return TypeRecords; }
58
60
63
64 std::vector<codeview::TypeIndex> findRecordsByName(StringRef Name) const;
65
67
69
70 Error commit();
71
72 void buildHashMap();
73
74 bool supportsTypeLookup() const;
75
76private:
77 PDBFile &Pdb;
78 std::unique_ptr<msf::MappedBlockStream> Stream;
79
80 std::unique_ptr<codeview::LazyRandomTypeCollection> Types;
81
82 BinarySubstreamRef TypeRecordsSubstream;
83
84 codeview::CVTypeArray TypeRecords;
85
86 std::unique_ptr<BinaryStream> HashStream;
90
91 std::vector<std::vector<codeview::TypeIndex>> HashMap;
92
93 const TpiStreamHeader *Header;
94};
95}
96}
97
98#endif
Lightweight arrays that are backed by an arbitrary BinaryStream.
std::string Name
Lightweight error class with error context and mandatory checking.
Definition: Error.h:160
Tagged union holding either a T or a Error.
Definition: Error.h:481
FixedStreamArray is similar to VarStreamArray, except with each record having a fixed-length.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
Provides amortized O(1) random access to a CodeView type stream.
A 32-bit type reference.
Definition: TypeIndex.h:96
A range adaptor for a pair of iterators.
uint32_t getHashKeySize() const
Definition: TpiStream.cpp:142
BinarySubstreamRef getTypeRecordsSubstream() const
Definition: TpiStream.cpp:226
HashTable< support::ulittle32_t > & getHashAdjusters()
Definition: TpiStream.cpp:238
std::vector< codeview::TypeIndex > findRecordsByName(StringRef Name) const
Definition: TpiStream.cpp:160
uint32_t TypeIndexBegin() const
Definition: TpiStream.cpp:125
PdbRaw_TpiVer getTpiVersion() const
Definition: TpiStream.cpp:120
codeview::CVTypeRange types(bool *HadError) const
Definition: TpiStream.cpp:242
FixedStreamArray< codeview::TypeIndexOffset > getTypeIndexOffsets() const
Definition: TpiStream.cpp:234
codeview::CVType getType(codeview::TypeIndex Index)
Definition: TpiStream.cpp:221
uint16_t getTypeHashStreamAuxIndex() const
Definition: TpiStream.cpp:137
const codeview::CVTypeArray & typeArray() const
Definition: TpiStream.h:57
uint16_t getTypeHashStreamIndex() const
Definition: TpiStream.cpp:133
bool supportsTypeLookup() const
Definition: TpiStream.cpp:177
FixedStreamArray< support::ulittle32_t > getHashValues() const
Definition: TpiStream.cpp:230
Expected< codeview::TypeIndex > findFullDeclForForwardRef(codeview::TypeIndex ForwardRefTI) const
Definition: TpiStream.cpp:180
uint32_t getNumTypeRecords() const
Definition: TpiStream.cpp:129
codeview::LazyRandomTypeCollection & typeCollection()
Definition: TpiStream.h:59
uint32_t TypeIndexEnd() const
Definition: TpiStream.cpp:127
uint32_t getNumHashBuckets() const
Definition: TpiStream.cpp:141
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18