summaryrefslogtreecommitdiffstats
path: root/llvm/include/llvm/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.h
blob: dd68f0fcffd8c73661d1f2baa4f8fa9a18147ffa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//===- ModuleDebugLineFragment.h --------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGFILECHECKSUMFRAGMENT_H
#define LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGFILECHECKSUMFRAGMENT_H

#include "llvm/ADT/ArrayRef.h"
#include "llvm/DebugInfo/CodeView/ModuleDebugFragment.h"
#include "llvm/Support/BinaryStreamArray.h"
#include "llvm/Support/BinaryStreamReader.h"
#include "llvm/Support/Endian.h"

namespace llvm {
namespace codeview {

struct FileChecksumEntry {
  uint32_t FileNameOffset;    // Byte offset of filename in global stringtable.
  FileChecksumKind Kind;      // The type of checksum.
  ArrayRef<uint8_t> Checksum; // The bytes of the checksum.
};
}
}

namespace llvm {
template <> struct VarStreamArrayExtractor<codeview::FileChecksumEntry> {
public:
  typedef void ContextType;

  static Error extract(BinaryStreamRef Stream, uint32_t &Len,
                       codeview::FileChecksumEntry &Item, void *Ctx);
};
}

namespace llvm {
namespace codeview {
class ModuleDebugFileChecksumFragment final : public ModuleDebugFragment {
  typedef VarStreamArray<FileChecksumEntry> FileChecksumArray;
  typedef FileChecksumArray::Iterator Iterator;

public:
  ModuleDebugFileChecksumFragment()
      : ModuleDebugFragment(ModuleDebugFragmentKind::FileChecksums) {}

  static bool classof(const ModuleDebugFragment *S) {
    return S->kind() == ModuleDebugFragmentKind::FileChecksums;
  }

  Error initialize(BinaryStreamReader Reader);

  Iterator begin() const { return Checksums.begin(); }
  Iterator end() const { return Checksums.end(); }

private:
  FileChecksumArray Checksums;
};
}
}

#endif
OpenPOWER on IntegriCloud