1 //===-- XCOFFYAML.cpp - XCOFF YAMLIO implementation -------------*- 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 XCOFF.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "llvm/ObjectYAML/XCOFFYAML.h"
14 #include <string.h>
15 
16 namespace llvm {
17 namespace XCOFFYAML {
18 
19 Object::Object() { memset(&Header, 0, sizeof(Header)); }
20 
21 } // namespace XCOFFYAML
22 
23 namespace yaml {
24 
25 void MappingTraits<XCOFFYAML::FileHeader>::mapping(
26     IO &IO, XCOFFYAML::FileHeader &FileHdr) {
27   IO.mapRequired("MagicNumber", FileHdr.Magic);
28   IO.mapRequired("NumberOfSections", FileHdr.NumberOfSections);
29   IO.mapRequired("CreationTime", FileHdr.TimeStamp);
30   IO.mapRequired("OffsetToSymbolTable", FileHdr.SymbolTableOffset);
31   IO.mapRequired("EntriesInSymbolTable", FileHdr.NumberOfSymTableEntries);
32   IO.mapRequired("AuxiliaryHeaderSize", FileHdr.AuxHeaderSize);
33   IO.mapRequired("Flags", FileHdr.Flags);
34 }
35 
36 void MappingTraits<XCOFFYAML::Object>::mapping(IO &IO, XCOFFYAML::Object &Obj) {
37   IO.mapTag("!XCOFF", true);
38   IO.mapRequired("FileHeader", Obj.Header);
39 }
40 
41 } // namespace yaml
42 } // namespace llvm
43