LLVM  14.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 
20 
21 #include "llvm/Support/Error.h"
22 
23 namespace llvm {
24 namespace codeview {
25 class LazyRandomTypeCollection;
26 }
27 namespace msf {
28 class MappedBlockStream;
29 }
30 namespace pdb {
31 class PDBFile;
32 
33 class TpiStream {
34  friend class TpiStreamBuilder;
35 
36 public:
37  TpiStream(PDBFile &File, std::unique_ptr<msf::MappedBlockStream> Stream);
38  ~TpiStream();
39  Error reload();
40 
42 
43  uint32_t TypeIndexBegin() const;
44  uint32_t TypeIndexEnd() const;
48 
49  uint32_t getHashKeySize() const;
54 
55  codeview::CVTypeRange types(bool *HadError) const;
56  const codeview::CVTypeArray &typeArray() const { return TypeRecords; }
57 
59 
62 
63  std::vector<codeview::TypeIndex> findRecordsByName(StringRef Name) const;
64 
66 
68 
69  Error commit();
70 
71  void buildHashMap();
72 
73  bool supportsTypeLookup() const;
74 
75 private:
76  PDBFile &Pdb;
77  std::unique_ptr<msf::MappedBlockStream> Stream;
78 
79  std::unique_ptr<codeview::LazyRandomTypeCollection> Types;
80 
81  BinarySubstreamRef TypeRecordsSubstream;
82 
83  codeview::CVTypeArray TypeRecords;
84 
85  std::unique_ptr<BinaryStream> HashStream;
88  HashTable<support::ulittle32_t> HashAdjusters;
89 
90  std::vector<std::vector<codeview::TypeIndex>> HashMap;
91 
92  const TpiStreamHeader *Header;
93 };
94 }
95 }
96 
97 #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: AllocatorList.h:23
RawTypes.h
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:42
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:200
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
PDBTypes.h
llvm::pdb::TpiStream::getHashValues
FixedStreamArray< support::ulittle32_t > getHashValues() const
Definition: TpiStream.cpp:230
Index
uint32_t Index
Definition: ELFObjHandler.cpp:84
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:47
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:57
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:52
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:157
CVRecord.h
llvm::pdb::HashTable
Definition: HashTable.h:34
llvm::pdb::TpiStream::getNumTypeRecords
uint32_t getNumTypeRecords() const
Definition: TpiStream.cpp:129
llvm::pdb::PDBFile
Definition: PDBFile.h:42
llvm::pdb::TpiStreamHeader
Definition: RawTypes.h:277
llvm::pdb::TpiStream
Definition: TpiStream.h:33
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:56
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
raw_ostream.h
llvm::pdb::TpiStream::typeCollection
codeview::LazyRandomTypeCollection & typeCollection()
Definition: TpiStream.h:58
llvm::pdb::TpiStream::~TpiStream
~TpiStream()
File
Instrumentation for Order File
Definition: InstrOrderFile.cpp:205
llvm::pdb::TpiStream::getTypeIndexOffsets
FixedStreamArray< codeview::TypeIndexOffset > getTypeIndexOffsets() const
Definition: TpiStream.cpp:234