]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/llvm/include/llvm/ObjectYAML/CodeViewYAMLTypeHashing.h
Move all sources from the llvm project into contrib/llvm-project.
[FreeBSD/FreeBSD.git] / contrib / llvm-project / llvm / include / llvm / ObjectYAML / CodeViewYAMLTypeHashing.h
1 //==- CodeViewYAMLTypeHashing.h - CodeView YAMLIO Type hashing ----*- 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 // This file defines classes for handling the YAML representation of CodeView
10 // Debug Info.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_OBJECTYAML_CODEVIEWYAMLTYPEHASHING_H
15 #define LLVM_OBJECTYAML_CODEVIEWYAMLTYPEHASHING_H
16
17 #include "llvm/ADT/ArrayRef.h"
18 #include "llvm/DebugInfo/CodeView/TypeHashing.h"
19 #include "llvm/ObjectYAML/YAML.h"
20 #include "llvm/Support/Allocator.h"
21 #include "llvm/Support/Error.h"
22 #include "llvm/Support/YAMLTraits.h"
23 #include <cstdint>
24 #include <memory>
25 #include <vector>
26
27 namespace llvm {
28
29 namespace CodeViewYAML {
30
31 struct GlobalHash {
32   GlobalHash() = default;
33   explicit GlobalHash(StringRef S) : Hash(S) {
34     assert(S.size() == 8 && "Invalid hash size!");
35   }
36   explicit GlobalHash(ArrayRef<uint8_t> S) : Hash(S) {
37     assert(S.size() == 8 && "Invalid hash size!");
38   }
39   yaml::BinaryRef Hash;
40 };
41
42 struct DebugHSection {
43   uint32_t Magic;
44   uint16_t Version;
45   uint16_t HashAlgorithm;
46   std::vector<GlobalHash> Hashes;
47 };
48
49 DebugHSection fromDebugH(ArrayRef<uint8_t> DebugH);
50 ArrayRef<uint8_t> toDebugH(const DebugHSection &DebugH,
51                            BumpPtrAllocator &Alloc);
52
53 } // end namespace CodeViewYAML
54
55 } // end namespace llvm
56
57 LLVM_YAML_DECLARE_MAPPING_TRAITS(CodeViewYAML::DebugHSection)
58 LLVM_YAML_DECLARE_SCALAR_TRAITS(CodeViewYAML::GlobalHash, QuotingType::None)
59 LLVM_YAML_IS_SEQUENCE_VECTOR(CodeViewYAML::GlobalHash)
60
61 #endif // LLVM_OBJECTYAML_CODEVIEWYAMLTYPES_H