1320572Sdim//==- CodeViewYAMLTypes.h - CodeView YAMLIO Type implementation --*- C++ -*-==//
2319461Sdim//
3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4353358Sdim// See https://llvm.org/LICENSE.txt for license information.
5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6319461Sdim//
7319461Sdim//===----------------------------------------------------------------------===//
8319461Sdim//
9319461Sdim// This file defines classes for handling the YAML representation of CodeView
10319461Sdim// Debug Info.
11319461Sdim//
12319461Sdim//===----------------------------------------------------------------------===//
13319461Sdim
14319461Sdim#ifndef LLVM_OBJECTYAML_CODEVIEWYAMLTYPES_H
15319461Sdim#define LLVM_OBJECTYAML_CODEVIEWYAMLTYPES_H
16319461Sdim
17320572Sdim#include "llvm/ADT/ArrayRef.h"
18319461Sdim#include "llvm/DebugInfo/CodeView/TypeRecord.h"
19319799Sdim#include "llvm/Support/Allocator.h"
20320572Sdim#include "llvm/Support/Error.h"
21320572Sdim#include "llvm/Support/YAMLTraits.h"
22320572Sdim#include <cstdint>
23320572Sdim#include <memory>
24320572Sdim#include <vector>
25319461Sdim
26319461Sdimnamespace llvm {
27320572Sdim
28319799Sdimnamespace codeview {
29327952Sdimclass AppendingTypeTableBuilder;
30327952Sdim}
31320572Sdim
32319461Sdimnamespace CodeViewYAML {
33320572Sdim
34319461Sdimnamespace detail {
35320572Sdim
36319461Sdimstruct LeafRecordBase;
37319461Sdimstruct MemberRecordBase;
38319461Sdim
39320572Sdim} // end namespace detail
40320572Sdim
41319461Sdimstruct MemberRecord {
42319461Sdim  std::shared_ptr<detail::MemberRecordBase> Member;
43319461Sdim};
44319461Sdim
45319461Sdimstruct LeafRecord {
46319461Sdim  std::shared_ptr<detail::LeafRecordBase> Leaf;
47319461Sdim
48327952Sdim  codeview::CVType
49327952Sdim  toCodeViewRecord(codeview::AppendingTypeTableBuilder &Serializer) const;
50319461Sdim  static Expected<LeafRecord> fromCodeViewRecord(codeview::CVType Type);
51319461Sdim};
52320041Sdim
53341825Sdimstd::vector<LeafRecord> fromDebugT(ArrayRef<uint8_t> DebugTorP,
54341825Sdim                                   StringRef SectionName);
55341825SdimArrayRef<uint8_t> toDebugT(ArrayRef<LeafRecord>, BumpPtrAllocator &Alloc,
56341825Sdim                           StringRef SectionName);
57319461Sdim
58320572Sdim} // end namespace CodeViewYAML
59320572Sdim
60320572Sdim} // end namespace llvm
61320572Sdim
62327952SdimLLVM_YAML_DECLARE_SCALAR_TRAITS(codeview::GUID, QuotingType::Single)
63321238Sdim
64319461SdimLLVM_YAML_DECLARE_MAPPING_TRAITS(CodeViewYAML::LeafRecord)
65319461SdimLLVM_YAML_DECLARE_MAPPING_TRAITS(CodeViewYAML::MemberRecord)
66319461Sdim
67319461SdimLLVM_YAML_IS_SEQUENCE_VECTOR(CodeViewYAML::LeafRecord)
68319461SdimLLVM_YAML_IS_SEQUENCE_VECTOR(CodeViewYAML::MemberRecord)
69319461Sdim
70320572Sdim#endif // LLVM_OBJECTYAML_CODEVIEWYAMLTYPES_H
71