LLVM 22.0.0git
TpiStreamBuilder.h
Go to the documentation of this file.
1//===- TpiStreamBuilder.h - PDB Tpi Stream Creation -------------*- 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_TPISTREAMBUILDER_H
10#define LLVM_DEBUGINFO_PDB_NATIVE_TPISTREAMBUILDER_H
11
18#include "llvm/Support/Error.h"
19
20#include <vector>
21
22namespace llvm {
24template <typename T> struct BinaryItemTraits;
25
27 static size_t length(const codeview::CVType &Item) { return Item.length(); }
29 return Item.data();
30 }
31};
32
33namespace msf {
34class MSFBuilder;
35struct MSFLayout;
36}
37namespace pdb {
38struct TpiStreamHeader;
39
41public:
42 LLVM_ABI explicit TpiStreamBuilder(msf::MSFBuilder &Msf, uint32_t StreamIdx);
44
47
50 std::optional<uint32_t> Hash);
53 ArrayRef<uint32_t> Hashes);
54
56
57 uint32_t getRecordCount() const { return TypeRecordCount; }
58
59 LLVM_ABI Error commit(const msf::MSFLayout &Layout,
61
63
64private:
65 void updateTypeIndexOffsets(ArrayRef<uint16_t> Sizes);
66
67 uint32_t calculateHashBufferSize() const;
68 uint32_t calculateIndexOffsetSize() const;
70
71 msf::MSFBuilder &Msf;
73
74 uint32_t TypeRecordCount = 0;
75 size_t TypeRecordBytes = 0;
76
78 std::vector<ArrayRef<uint8_t>> TypeRecBuffers;
79 std::vector<uint32_t> TypeHashes;
80 std::vector<codeview::TypeIndexOffset> TypeIndexOffsets;
81 uint32_t HashStreamIndex = kInvalidStreamIndex;
82 std::unique_ptr<BinaryByteStream> HashValueStream;
83
84 const TpiStreamHeader *Header;
85 uint32_t Idx;
86};
87} // namespace pdb
88}
89
90#endif
arc branch finalize
This file defines the BumpPtrAllocator interface.
#define LLVM_ABI
Definition Compiler.h:213
Basic Register Allocator
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:41
An implementation of BinaryStream which holds its entire data set in a single contiguous buffer.
Lightweight error class with error context and mandatory checking.
Definition Error.h:159
ArrayRef< uint8_t > data() const
Definition CVRecord.h:49
uint32_t length() const
Definition CVRecord.h:40
TpiStreamBuilder & operator=(const TpiStreamBuilder &)=delete
LLVM_ABI void addTypeRecord(ArrayRef< uint8_t > Type, std::optional< uint32_t > Hash)
LLVM_ABI Error commit(const msf::MSFLayout &Layout, WritableBinaryStreamRef Buffer)
LLVM_ABI void addTypeRecords(ArrayRef< uint8_t > Types, ArrayRef< uint16_t > Sizes, ArrayRef< uint32_t > Hashes)
LLVM_ABI TpiStreamBuilder(msf::MSFBuilder &Msf, uint32_t StreamIdx)
LLVM_ABI uint32_t calculateSerializedLength()
TpiStreamBuilder(const TpiStreamBuilder &)=delete
LLVM_ABI void setVersionHeader(PdbRaw_TpiVer Version)
CVRecord< TypeLeafKind > CVType
Definition CVRecord.h:64
const uint16_t kInvalidStreamIndex
This is an optimization pass for GlobalISel generic memory operations.
FunctionAddr VTableAddr uintptr_t uintptr_t Version
Definition InstrProf.h:302
BumpPtrAllocatorImpl BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
Definition Allocator.h:383
static ArrayRef< uint8_t > bytes(const codeview::CVType &Item)
static size_t length(const codeview::CVType &Item)