[InstCombine] Signed saturation patterns
[llvm-complete.git] / include / llvm / DebugInfo / PDB / Native / TpiStream.h
blob1b7fd2d54cb22412c0ae0199995ae922ed230fce
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 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_DEBUGINFO_PDB_RAW_PDBTPISTREAM_H
10 #define LLVM_DEBUGINFO_PDB_RAW_PDBTPISTREAM_H
12 #include "llvm/DebugInfo/CodeView/TypeRecord.h"
13 #include "llvm/DebugInfo/PDB/Native/HashTable.h"
14 #include "llvm/DebugInfo/PDB/Native/RawConstants.h"
15 #include "llvm/DebugInfo/PDB/Native/RawTypes.h"
16 #include "llvm/DebugInfo/PDB/PDBTypes.h"
17 #include "llvm/Support/BinaryStreamArray.h"
18 #include "llvm/Support/BinaryStreamRef.h"
19 #include "llvm/Support/raw_ostream.h"
21 #include "llvm/Support/Error.h"
23 namespace llvm {
24 namespace codeview {
25 class LazyRandomTypeCollection;
27 namespace msf {
28 class MappedBlockStream;
30 namespace pdb {
31 class PDBFile;
33 class TpiStream {
34 friend class TpiStreamBuilder;
36 public:
37 TpiStream(PDBFile &File, std::unique_ptr<msf::MappedBlockStream> Stream);
38 ~TpiStream();
39 Error reload();
41 PdbRaw_TpiVer getTpiVersion() const;
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;
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();
55 codeview::CVTypeRange types(bool *HadError) const;
56 const codeview::CVTypeArray &typeArray() const { return TypeRecords; }
58 codeview::LazyRandomTypeCollection &typeCollection() { return *Types; }
60 Expected<codeview::TypeIndex>
61 findFullDeclForForwardRef(codeview::TypeIndex ForwardRefTI) const;
63 std::vector<codeview::TypeIndex> findRecordsByName(StringRef Name) const;
65 codeview::CVType getType(codeview::TypeIndex Index);
67 BinarySubstreamRef getTypeRecordsSubstream() const;
69 Error commit();
71 void buildHashMap();
73 bool supportsTypeLookup() const;
75 private:
76 PDBFile &Pdb;
77 std::unique_ptr<msf::MappedBlockStream> Stream;
79 std::unique_ptr<codeview::LazyRandomTypeCollection> Types;
81 BinarySubstreamRef TypeRecordsSubstream;
83 codeview::CVTypeArray TypeRecords;
85 std::unique_ptr<BinaryStream> HashStream;
86 FixedStreamArray<support::ulittle32_t> HashValues;
87 FixedStreamArray<codeview::TypeIndexOffset> TypeIndexOffsets;
88 HashTable<support::ulittle32_t> HashAdjusters;
90 std::vector<std::vector<codeview::TypeIndex>> HashMap;
92 const TpiStreamHeader *Header;
97 #endif