1 //===- COFFYAML.h - COFF YAMLIO implementation ------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file declares classes for handling the YAML representation of COFF.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_OBJECT_COFFYAML_H
15 #define LLVM_OBJECT_COFFYAML_H
17 #include "llvm/Object/YAML.h"
18 #include "llvm/Support/COFF.h"
23 inline Characteristics operator|(Characteristics a, Characteristics b) {
24 uint32_t Ret = static_cast<uint32_t>(a) | static_cast<uint32_t>(b);
25 return static_cast<Characteristics>(Ret);
28 inline SectionCharacteristics operator|(SectionCharacteristics a,
29 SectionCharacteristics b) {
30 uint32_t Ret = static_cast<uint32_t>(a) | static_cast<uint32_t>(b);
31 return static_cast<SectionCharacteristics>(Ret);
35 // The structure of the yaml files is not an exact 1:1 match to COFF. In order
36 // to use yaml::IO, we use these structures which are closer to the source.
39 uint32_t VirtualAddress;
47 object::yaml::BinaryRef SectionData;
48 std::vector<Relocation> Relocations;
55 COFF::SymbolBaseType SimpleType;
56 COFF::SymbolComplexType ComplexType;
57 object::yaml::BinaryRef AuxiliaryData;
64 std::vector<Section> Sections;
65 std::vector<Symbol> Symbols;
71 LLVM_YAML_IS_SEQUENCE_VECTOR(COFFYAML::Section)
72 LLVM_YAML_IS_SEQUENCE_VECTOR(COFFYAML::Symbol)
73 LLVM_YAML_IS_SEQUENCE_VECTOR(COFFYAML::Relocation)
79 struct ScalarEnumerationTraits<COFF::MachineTypes> {
80 static void enumeration(IO &IO, COFF::MachineTypes &Value);
84 struct ScalarEnumerationTraits<COFF::SymbolBaseType> {
85 static void enumeration(IO &IO, COFF::SymbolBaseType &Value);
89 struct ScalarEnumerationTraits<COFF::SymbolStorageClass> {
90 static void enumeration(IO &IO, COFF::SymbolStorageClass &Value);
94 struct ScalarEnumerationTraits<COFF::SymbolComplexType> {
95 static void enumeration(IO &IO, COFF::SymbolComplexType &Value);
99 struct ScalarEnumerationTraits<COFF::RelocationTypeX86> {
100 static void enumeration(IO &IO, COFF::RelocationTypeX86 &Value);
104 struct ScalarBitSetTraits<COFF::Characteristics> {
105 static void bitset(IO &IO, COFF::Characteristics &Value);
109 struct ScalarBitSetTraits<COFF::SectionCharacteristics> {
110 static void bitset(IO &IO, COFF::SectionCharacteristics &Value);
114 struct MappingTraits<COFFYAML::Relocation> {
115 static void mapping(IO &IO, COFFYAML::Relocation &Rel);
119 struct MappingTraits<COFF::header> {
120 static void mapping(IO &IO, COFF::header &H);
124 struct MappingTraits<COFFYAML::Symbol> {
125 static void mapping(IO &IO, COFFYAML::Symbol &S);
129 struct MappingTraits<COFFYAML::Section> {
130 static void mapping(IO &IO, COFFYAML::Section &Sec);
134 struct MappingTraits<COFFYAML::Object> {
135 static void mapping(IO &IO, COFFYAML::Object &Obj);
138 } // end namespace yaml
139 } // end namespace llvm