Subversion Repositories QNX 8.QNX8 LLVM/Clang compiler suite

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
14 pmbaty 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
 
12
#include "llvm/DebugInfo/CodeView/CVRecord.h"
13
#include "llvm/DebugInfo/PDB/Native/HashTable.h"
14
#include "llvm/DebugInfo/PDB/Native/RawConstants.h"
15
#include "llvm/Support/BinaryStreamArray.h"
16
#include "llvm/Support/BinaryStreamRef.h"
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
 
42
  PdbRaw_TpiVer getTpiVersion() const;
43
 
44
  uint32_t TypeIndexBegin() const;
45
  uint32_t TypeIndexEnd() const;
46
  uint32_t getNumTypeRecords() const;
47
  uint16_t getTypeHashStreamIndex() const;
48
  uint16_t getTypeHashStreamAuxIndex() const;
49
 
50
  uint32_t getHashKeySize() const;
51
  uint32_t getNumHashBuckets() const;
52
  FixedStreamArray<support::ulittle32_t> getHashValues() const;
53
  FixedStreamArray<codeview::TypeIndexOffset> getTypeIndexOffsets() const;
54
  HashTable<support::ulittle32_t> &getHashAdjusters();
55
 
56
  codeview::CVTypeRange types(bool *HadError) const;
57
  const codeview::CVTypeArray &typeArray() const { return TypeRecords; }
58
 
59
  codeview::LazyRandomTypeCollection &typeCollection() { return *Types; }
60
 
61
  Expected<codeview::TypeIndex>
62
  findFullDeclForForwardRef(codeview::TypeIndex ForwardRefTI) const;
63
 
64
  std::vector<codeview::TypeIndex> findRecordsByName(StringRef Name) const;
65
 
66
  codeview::CVType getType(codeview::TypeIndex Index);
67
 
68
  BinarySubstreamRef getTypeRecordsSubstream() const;
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;
87
  FixedStreamArray<support::ulittle32_t> HashValues;
88
  FixedStreamArray<codeview::TypeIndexOffset> TypeIndexOffsets;
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