1 //===-- XCOFFYAML.cpp - XCOFF YAMLIO implementation -------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 // This file defines classes for handling the YAML representation of XCOFF.
11 //===----------------------------------------------------------------------===//
13 #include "llvm/ObjectYAML/XCOFFYAML.h"
14 #include "llvm/BinaryFormat/XCOFF.h"
20 Object::Object() { memset(&Header
, 0, sizeof(Header
)); }
22 } // namespace XCOFFYAML
26 void ScalarEnumerationTraits
<XCOFF::StorageClass
>::enumeration(
27 IO
&IO
, XCOFF::StorageClass
&Value
) {
28 #define ECase(X) IO.enumCase(Value, #X, XCOFF::X)
82 void MappingTraits
<XCOFFYAML::FileHeader
>::mapping(
83 IO
&IO
, XCOFFYAML::FileHeader
&FileHdr
) {
84 IO
.mapRequired("MagicNumber", FileHdr
.Magic
);
85 IO
.mapRequired("NumberOfSections", FileHdr
.NumberOfSections
);
86 IO
.mapRequired("CreationTime", FileHdr
.TimeStamp
);
87 IO
.mapRequired("OffsetToSymbolTable", FileHdr
.SymbolTableOffset
);
88 IO
.mapRequired("EntriesInSymbolTable", FileHdr
.NumberOfSymTableEntries
);
89 IO
.mapRequired("AuxiliaryHeaderSize", FileHdr
.AuxHeaderSize
);
90 IO
.mapRequired("Flags", FileHdr
.Flags
);
93 void MappingTraits
<XCOFFYAML::Symbol
>::mapping(IO
&IO
, XCOFFYAML::Symbol
&S
) {
94 IO
.mapRequired("Name", S
.SymbolName
);
95 IO
.mapRequired("Value", S
.Value
);
96 IO
.mapRequired("Section", S
.SectionName
);
97 IO
.mapRequired("Type", S
.Type
);
98 IO
.mapRequired("StorageClass", S
.StorageClass
);
99 IO
.mapRequired("NumberOfAuxEntries", S
.NumberOfAuxEntries
);
102 void MappingTraits
<XCOFFYAML::Object
>::mapping(IO
&IO
, XCOFFYAML::Object
&Obj
) {
103 IO
.mapTag("!XCOFF", true);
104 IO
.mapRequired("FileHeader", Obj
.Header
);
105 IO
.mapRequired("Symbols", Obj
.Symbols
);