LLVM 20.0.0git
DebugChecksumsSubsection.h
Go to the documentation of this file.
1//===- DebugChecksumsSubsection.h -------------------------------*- 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_CODEVIEW_DEBUGCHECKSUMSSUBSECTION_H
10#define LLVM_DEBUGINFO_CODEVIEW_DEBUGCHECKSUMSSUBSECTION_H
11
12#include "llvm/ADT/ArrayRef.h"
13#include "llvm/ADT/DenseMap.h"
14#include "llvm/ADT/StringRef.h"
20#include "llvm/Support/Error.h"
21#include <cstdint>
22#include <vector>
23
24namespace llvm {
25
26class BinaryStreamReader;
27class BinaryStreamWriter;
28
29namespace codeview {
30
31class DebugStringTableSubsection;
32
34 uint32_t FileNameOffset; // Byte offset of filename in global stringtable.
35 FileChecksumKind Kind; // The type of checksum.
36 ArrayRef<uint8_t> Checksum; // The bytes of the checksum.
37};
38
39} // end namespace codeview
40
41template <> struct VarStreamArrayExtractor<codeview::FileChecksumEntry> {
42public:
43 using ContextType = void;
44
47};
48
49namespace codeview {
50
54
55public:
58
59 static bool classof(const DebugSubsectionRef *S) {
61 }
62
63 bool valid() const { return Checksums.valid(); }
64
67
68 Iterator begin() const { return Checksums.begin(); }
69 Iterator end() const { return Checksums.end(); }
70
71 const FileChecksumArray &getArray() const { return Checksums; }
72
73private:
74 FileChecksumArray Checksums;
75};
76
78public:
80
81 static bool classof(const DebugSubsection *S) {
83 }
84
86 ArrayRef<uint8_t> Bytes);
87
88 uint32_t calculateSerializedSize() const override;
89 Error commit(BinaryStreamWriter &Writer) const override;
90 uint32_t mapChecksumOffset(StringRef FileName) const;
91
92private:
94
96 uint32_t SerializedSize = 0;
97 BumpPtrAllocator Storage;
98 std::vector<FileChecksumEntry> Checksums;
99};
100
101} // end namespace codeview
102
103} // end namespace llvm
104
105#endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGCHECKSUMSSUBSECTION_H
This file defines the BumpPtrAllocator interface.
Lightweight arrays that are backed by an arbitrary BinaryStream.
This file defines the DenseMap class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
Provides read only access to a subclass of BinaryStream.
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.
Provides write only access to a subclass of WritableBinaryStream.
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:66
Lightweight error class with error context and mandatory checking.
Definition: Error.h:160
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
VarStreamArray represents an array of variable length records backed by a stream.
Iterator end() const
VarStreamArrayIterator< codeview::FileChecksumEntry, VarStreamArrayExtractor< codeview::FileChecksumEntry > > Iterator
Iterator begin(bool *HadError=nullptr) const
static bool classof(const DebugSubsectionRef *S)
Error commit(BinaryStreamWriter &Writer) const override
uint32_t mapChecksumOffset(StringRef FileName) const
void addChecksum(StringRef FileName, FileChecksumKind Kind, ArrayRef< uint8_t > Bytes)
static bool classof(const DebugSubsection *S)
Represents a read-write view of a CodeView string table.
DebugSubsectionKind kind() const
DebugSubsectionKind kind() const
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
Error operator()(BinaryStreamRef Stream, uint32_t &Len, codeview::FileChecksumEntry &Item)
VarStreamArrayExtractor is intended to be specialized to provide customized extraction logic.