LLVM  10.0.0svn
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"
17 #include "llvm/Support/Allocator.h"
21 #include "llvm/Support/Error.h"
22 #include <cstdint>
23 #include <vector>
24 
25 namespace llvm {
26 
27 namespace codeview {
28 
29 class DebugStringTableSubsection;
30 
32  uint32_t FileNameOffset; // Byte offset of filename in global stringtable.
33  FileChecksumKind Kind; // The type of checksum.
34  ArrayRef<uint8_t> Checksum; // The bytes of the checksum.
35 };
36 
37 } // end namespace codeview
38 
39 template <> struct VarStreamArrayExtractor<codeview::FileChecksumEntry> {
40 public:
41  using ContextType = void;
42 
43  Error operator()(BinaryStreamRef Stream, uint32_t &Len,
45 };
46 
47 namespace codeview {
48 
52 
53 public:
56 
57  static bool classof(const DebugSubsectionRef *S) {
59  }
60 
61  bool valid() const { return Checksums.valid(); }
62 
65 
66  Iterator begin() const { return Checksums.begin(); }
67  Iterator end() const { return Checksums.end(); }
68 
69  const FileChecksumArray &getArray() const { return Checksums; }
70 
71 private:
72  FileChecksumArray Checksums;
73 };
74 
76 public:
78 
79  static bool classof(const DebugSubsection *S) {
81  }
82 
83  void addChecksum(StringRef FileName, FileChecksumKind Kind,
84  ArrayRef<uint8_t> Bytes);
85 
86  uint32_t calculateSerializedSize() const override;
87  Error commit(BinaryStreamWriter &Writer) const override;
88  uint32_t mapChecksumOffset(StringRef FileName) const;
89 
90 private:
92 
94  uint32_t SerializedSize = 0;
95  BumpPtrAllocator Storage;
96  std::vector<FileChecksumEntry> Checksums;
97 };
98 
99 } // end namespace codeview
100 
101 } // end namespace llvm
102 
103 #endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGCHECKSUMSSUBSECTION_H
This class represents lattice values for constants.
Definition: AllocatorList.h:23
static bool classof(const DebugSubsection *S)
VarStreamArrayExtractor is intended to be specialized to provide customized extraction logic...
This file defines the MallocAllocator and BumpPtrAllocator interfaces.
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:140
Provides write only access to a subclass of WritableBinaryStream.
Represents a read-write view of a CodeView string table.
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.
VarStreamArray represents an array of variable length records backed by a stream. ...
DebugSubsectionKind kind() const
static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T, ArrayRef< StringRef > StandardNames)
Initialize the set of available library functions based on the specified target triple.
static bool classof(const DebugSubsectionRef *S)
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
Provides read only access to a subclass of BinaryStream.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48
DebugSubsectionKind kind() const