[llvm-readobj] - Simplify stack-sizes.test test case.
[llvm-complete.git] / lib / ObjectYAML / XCOFFYAML.cpp
blob982e6aecbb987da1b144be585d142eef580b46b4
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.
11 //===----------------------------------------------------------------------===//
13 #include "llvm/ObjectYAML/XCOFFYAML.h"
14 #include "llvm/BinaryFormat/XCOFF.h"
15 #include <string.h>
17 namespace llvm {
18 namespace XCOFFYAML {
20 Object::Object() { memset(&Header, 0, sizeof(Header)); }
22 } // namespace XCOFFYAML
24 namespace yaml {
26 void ScalarEnumerationTraits<XCOFF::StorageClass>::enumeration(
27 IO &IO, XCOFF::StorageClass &Value) {
28 #define ECase(X) IO.enumCase(Value, #X, XCOFF::X)
29 ECase(C_NULL);
30 ECase(C_AUTO);
31 ECase(C_EXT);
32 ECase(C_STAT);
33 ECase(C_REG);
34 ECase(C_EXTDEF);
35 ECase(C_LABEL);
36 ECase(C_ULABEL);
37 ECase(C_MOS);
38 ECase(C_ARG);
39 ECase(C_STRTAG);
40 ECase(C_MOU);
41 ECase(C_UNTAG);
42 ECase(C_TPDEF);
43 ECase(C_USTATIC);
44 ECase(C_ENTAG);
45 ECase(C_MOE);
46 ECase(C_REGPARM);
47 ECase(C_FIELD);
48 ECase(C_BLOCK);
49 ECase(C_FCN);
50 ECase(C_EOS);
51 ECase(C_FILE);
52 ECase(C_LINE);
53 ECase(C_ALIAS);
54 ECase(C_HIDDEN);
55 ECase(C_HIDEXT);
56 ECase(C_BINCL);
57 ECase(C_EINCL);
58 ECase(C_INFO);
59 ECase(C_WEAKEXT);
60 ECase(C_DWARF);
61 ECase(C_GSYM);
62 ECase(C_LSYM);
63 ECase(C_PSYM);
64 ECase(C_RSYM);
65 ECase(C_RPSYM);
66 ECase(C_STSYM);
67 ECase(C_TCSYM);
68 ECase(C_BCOMM);
69 ECase(C_ECOML);
70 ECase(C_ECOMM);
71 ECase(C_DECL);
72 ECase(C_ENTRY);
73 ECase(C_FUN);
74 ECase(C_BSTAT);
75 ECase(C_ESTAT);
76 ECase(C_GTLS);
77 ECase(C_STTLS);
78 ECase(C_EFCN);
79 #undef ECase
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);
108 } // namespace yaml
109 } // namespace llvm