LLVM 23.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
52 ArrayRef<uint32_t> Hashes);
53
55
56 uint32_t getRecordCount() const { return TypeRecordCount; }
57
58 LLVM_ABI Error commit(const msf::MSFLayout &Layout,
60
62
63private:
64 void updateTypeIndexOffsets(ArrayRef<uint16_t> Sizes);
65
66 uint32_t calculateHashBufferSize() const;
67 uint32_t calculateIndexOffsetSize() const;
69
70 msf::MSFBuilder &Msf;
72
73 uint32_t TypeRecordCount = 0;
74 size_t TypeRecordBytes = 0;
75
77 std::vector<ArrayRef<uint8_t>> TypeRecBuffers;
78 std::vector<uint32_t> TypeHashes;
79 std::vector<codeview::TypeIndexOffset> TypeIndexOffsets;
80 uint32_t HashStreamIndex = kInvalidStreamIndex;
81 std::unique_ptr<BinaryByteStream> HashValueStream;
82
83 const TpiStreamHeader *Header;
84 uint32_t Idx;
85};
86} // namespace pdb
87}
88
89#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:40
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
LLVM_ABI void addTypeRecord(ArrayRef< uint8_t > Type, uint32_t Hash)
TpiStreamBuilder & operator=(const TpiStreamBuilder &)=delete
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.
Definition Types.h:26
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)