1 //===- DXContainerYAML.cpp - DXContainer YAMLIO implementation ------------===//
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
10 // DXContainerYAML.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "llvm/ObjectYAML/DXContainerYAML.h"
15 
16 namespace llvm {
17 namespace yaml {
18 
19 void MappingTraits<DXContainerYAML::VersionTuple>::mapping(
20     IO &IO, DXContainerYAML::VersionTuple &Version) {
21   IO.mapRequired("Major", Version.Major);
22   IO.mapRequired("Minor", Version.Minor);
23 }
24 
25 void MappingTraits<DXContainerYAML::FileHeader>::mapping(
26     IO &IO, DXContainerYAML::FileHeader &Header) {
27   IO.mapRequired("Hash", Header.Hash);
28   IO.mapRequired("Version", Header.Version);
29   IO.mapOptional("FileSize", Header.FileSize);
30   IO.mapRequired("PartCount", Header.PartCount);
31   IO.mapOptional("PartOffsets", Header.PartOffsets);
32 }
33 
34 void MappingTraits<DXContainerYAML::Part>::mapping(IO &IO,
35                                                    DXContainerYAML::Part &P) {
36   IO.mapRequired("Name", P.Name);
37   IO.mapRequired("Size", P.Size);
38 }
39 
40 void MappingTraits<DXContainerYAML::Object>::mapping(
41     IO &IO, DXContainerYAML::Object &Obj) {
42   IO.mapTag("!dxcontainer", true);
43   IO.mapRequired("Header", Obj.Header);
44   IO.mapRequired("Parts", Obj.Parts);
45 }
46 
47 } // namespace yaml
48 } // namespace llvm
49