LLVM  15.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 
20 namespace llvm {
21 class BinaryStream;
22 namespace codeview {
23 class TypeIndex;
24 struct TypeIndexOffset;
25 class LazyRandomTypeCollection;
26 }
27 namespace msf {
28 class MappedBlockStream;
29 }
30 namespace pdb {
31 struct TpiStreamHeader;
32 class PDBFile;
33 
34 class TpiStream {
35  friend class TpiStreamBuilder;
36 
37 public:
38  TpiStream(PDBFile &File, std::unique_ptr<msf::MappedBlockStream> Stream);
39  ~TpiStream();
40  Error reload();
41 
43 
44  uint32_t TypeIndexBegin() const;
45  uint32_t TypeIndexEnd() const;
49 
50  uint32_t getHashKeySize() const;
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 
76 private:
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;
89  HashTable<support::ulittle32_t> HashAdjusters;
90 
91  std::vector<std::vector<codeview::TypeIndex>> HashMap;
92 
93  const TpiStreamHeader *Header;
94 };
95 }
96 }
97 
98 #endif
llvm::pdb::TpiStream::TypeIndexEnd
uint32_t TypeIndexEnd() const
Definition: TpiStream.cpp:127
RawConstants.h
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::pdb::TpiStream::supportsTypeLookup
bool supportsTypeLookup() const
Definition: TpiStream.cpp:177
llvm::pdb::TpiStream::getTypeRecordsSubstream
BinarySubstreamRef getTypeRecordsSubstream() const
Definition: TpiStream.cpp:226
llvm::pdb::TpiStream::getTypeHashStreamAuxIndex
uint16_t getTypeHashStreamAuxIndex() const
Definition: TpiStream.cpp:137
Error.h
llvm::pdb::TpiStream::getTypeHashStreamIndex
uint16_t getTypeHashStreamIndex() const
Definition: TpiStream.cpp:133
HashTable.h
llvm::pdb::TpiStream::getTpiVersion
PdbRaw_TpiVer getTpiVersion() const
Definition: TpiStream.cpp:120
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:41
llvm::FixedStreamArray< support::ulittle32_t >
llvm::pdb::TpiStream::reload
Error reload()
Definition: TpiStream.cpp:41
llvm::pdb::TpiStream::getHashAdjusters
HashTable< support::ulittle32_t > & getHashAdjusters()
Definition: TpiStream.cpp:238
llvm::pdb::TpiStream::commit
Error commit()
Definition: TpiStream.cpp:246
llvm::BinarySubstreamRef
Definition: BinaryStreamRef.h:199
llvm::VarStreamArray< CVType >
llvm::codeview::LazyRandomTypeCollection
Provides amortized O(1) random access to a CodeView type stream.
Definition: LazyRandomTypeCollection.h:49
llvm::pdb::PdbRaw_TpiVer
PdbRaw_TpiVer
Definition: RawConstants.h:59
llvm::pdb::TpiStream::getType
codeview::CVType getType(codeview::TypeIndex Index)
Definition: TpiStream.cpp:221
llvm::pdb::TpiStream::getHashValues
FixedStreamArray< support::ulittle32_t > getHashValues() const
Definition: TpiStream.cpp:230
Index
uint32_t Index
Definition: ELFObjHandler.cpp:82
llvm::pdb::TpiStream::TypeIndexBegin
uint32_t TypeIndexBegin() const
Definition: TpiStream.cpp:125
llvm::pdb::TpiStream::getHashKeySize
uint32_t getHashKeySize() const
Definition: TpiStream.cpp:142
BinaryStreamArray.h
llvm::pdb::TpiStreamBuilder
Definition: TpiStreamBuilder.h:40
llvm::pdb::TpiStream::TpiStream
TpiStream(PDBFile &File, std::unique_ptr< msf::MappedBlockStream > Stream)
Definition: TpiStream.cpp:36
llvm::pdb::TpiStream::buildHashMap
void buildHashMap()
Definition: TpiStream.cpp:144
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
BinaryStreamRef.h
llvm::codeview::CVRecord< TypeLeafKind >
uint32_t
llvm::pdb::TpiStream::findFullDeclForForwardRef
Expected< codeview::TypeIndex > findFullDeclForForwardRef(codeview::TypeIndex ForwardRefTI) const
Definition: TpiStream.cpp:180
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:50
llvm::pdb::TpiStream::getNumHashBuckets
uint32_t getNumHashBuckets() const
Definition: TpiStream.cpp:141
uint16_t
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:155
CVRecord.h
llvm::pdb::HashTable
Definition: HashTable.h:31
llvm::pdb::TpiStream::getNumTypeRecords
uint32_t getNumTypeRecords() const
Definition: TpiStream.cpp:129
llvm::pdb::PDBFile
Definition: PDBFile.h:40
llvm::pdb::TpiStreamHeader
Definition: RawTypes.h:277
llvm::pdb::TpiStream
Definition: TpiStream.h:34
llvm::iterator_range
A range adaptor for a pair of iterators.
Definition: iterator_range.h:30
llvm::codeview::TypeIndex
A 32-bit type reference.
Definition: TypeIndex.h:96
llvm::pdb::TpiStream::typeArray
const codeview::CVTypeArray & typeArray() const
Definition: TpiStream.h:57
llvm::pdb::TpiStream::types
codeview::CVTypeRange types(bool *HadError) const
Definition: TpiStream.cpp:242
llvm::pdb::TpiStream::findRecordsByName
std::vector< codeview::TypeIndex > findRecordsByName(StringRef Name) const
Definition: TpiStream.cpp:160
llvm::pdb::TpiStream::typeCollection
codeview::LazyRandomTypeCollection & typeCollection()
Definition: TpiStream.h:59
llvm::pdb::TpiStream::~TpiStream
~TpiStream()
File
Instrumentation for Order File
Definition: InstrOrderFile.cpp:198
llvm::pdb::TpiStream::getTypeIndexOffsets
FixedStreamArray< codeview::TypeIndexOffset > getTypeIndexOffsets() const
Definition: TpiStream.cpp:234