LLVM  9.0.0svn
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_RAW_PDBTPISTREAM_H
10 #define LLVM_DEBUGINFO_PDB_RAW_PDBTPISTREAM_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 
41  PdbRaw_TpiVer getTpiVersion() const;
42 
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;
48 
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();
54 
55  codeview::CVTypeRange types(bool *HadError) const;
56  const codeview::CVTypeArray &typeArray() const { return TypeRecords; }
57 
59 
61  findFullDeclForForwardRef(codeview::TypeIndex ForwardRefTI) const;
62 
63  std::vector<codeview::TypeIndex> findRecordsByName(StringRef Name) const;
64 
66 
67  BinarySubstreamRef getTypeRecordsSubstream() const;
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
This class represents lattice values for constants.
Definition: AllocatorList.h:23
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
codeview::LazyRandomTypeCollection & typeCollection()
Definition: TpiStream.h:58
const codeview::CVTypeArray & typeArray() const
Definition: TpiStream.h:56
Tagged union holding either a T or a Error.
Definition: CachePruning.h:22
A 32-bit type reference.
Definition: TypeIndex.h:95
static wasm::ValType getType(const TargetRegisterClass *RC)
A range adaptor for a pair of iterators.
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48
Provides amortized O(1) random access to a CodeView type stream.