Line data Source code
1 : //===- TpiStream.cpp - PDB Type Info (TPI) Stream 2 Access ------*- C++ -*-===//
2 : //
3 : // The LLVM Compiler Infrastructure
4 : //
5 : // This file is distributed under the University of Illinois Open Source
6 : // License. See LICENSE.TXT for details.
7 : //
8 : //===----------------------------------------------------------------------===//
9 :
10 : #ifndef LLVM_DEBUGINFO_PDB_RAW_PDBTPISTREAM_H
11 : #define LLVM_DEBUGINFO_PDB_RAW_PDBTPISTREAM_H
12 :
13 : #include "llvm/DebugInfo/CodeView/TypeRecord.h"
14 : #include "llvm/DebugInfo/MSF/StreamArray.h"
15 : #include "llvm/DebugInfo/PDB/PDBTypes.h"
16 : #include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
17 : #include "llvm/DebugInfo/PDB/Raw/RawTypes.h"
18 : #include "llvm/Support/raw_ostream.h"
19 :
20 : #include "llvm/Support/Error.h"
21 :
22 : namespace llvm {
23 : namespace msf {
24 : class MappedBlockStream;
25 : }
26 : namespace pdb {
27 : class PDBFile;
28 :
29 45 : class TpiStream {
30 : friend class TpiStreamBuilder;
31 :
32 : public:
33 : TpiStream(const PDBFile &File,
34 : std::unique_ptr<msf::MappedBlockStream> Stream);
35 : ~TpiStream();
36 : Error reload();
37 :
38 : PdbRaw_TpiVer getTpiVersion() const;
39 :
40 : uint32_t TypeIndexBegin() const;
41 : uint32_t TypeIndexEnd() const;
42 : uint32_t NumTypeRecords() const;
43 : uint16_t getTypeHashStreamIndex() const;
44 : uint16_t getTypeHashStreamAuxIndex() const;
45 :
46 : uint32_t getHashKeySize() const;
47 : uint32_t NumHashBuckets() const;
48 : msf::FixedStreamArray<support::ulittle32_t> getHashValues() const;
49 : msf::FixedStreamArray<TypeIndexOffset> getTypeIndexOffsets() const;
50 : msf::FixedStreamArray<TypeIndexOffset> getHashAdjustments() const;
51 :
52 : iterator_range<codeview::CVTypeArray::Iterator> types(bool *HadError) const;
53 :
54 : Error commit();
55 :
56 : private:
57 : Error verifyHashValues();
58 :
59 : const PDBFile &Pdb;
60 : std::unique_ptr<msf::MappedBlockStream> Stream;
61 :
62 : codeview::CVTypeArray TypeRecords;
63 :
64 : std::unique_ptr<msf::ReadableStream> HashStream;
65 : msf::FixedStreamArray<support::ulittle32_t> HashValues;
66 : msf::FixedStreamArray<TypeIndexOffset> TypeIndexOffsets;
67 : msf::FixedStreamArray<TypeIndexOffset> HashAdjustments;
68 :
69 : const TpiStreamHeader *Header;
70 : };
71 : }
72 : }
73 :
74 : #endif
|