LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
COFFYAML.h
Go to the documentation of this file.
1 //===- COFFYAML.h - COFF YAMLIO implementation ------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares classes for handling the YAML representation of COFF.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_OBJECT_COFFYAML_H
15 #define LLVM_OBJECT_COFFYAML_H
16 
17 #include "llvm/Object/YAML.h"
18 #include "llvm/Support/COFF.h"
19 
20 namespace llvm {
21 
22 namespace COFF {
24  uint32_t Ret = static_cast<uint32_t>(a) | static_cast<uint32_t>(b);
25  return static_cast<Characteristics>(Ret);
26 }
27 
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);
32 }
33 }
34 
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.
37 namespace COFFYAML {
38  struct Relocation {
39  uint32_t VirtualAddress;
40  uint16_t Type;
42  };
43 
44  struct Section {
46  unsigned Alignment;
48  std::vector<Relocation> Relocations;
50  Section();
51  };
52 
53  struct Symbol {
59  Symbol();
60  };
61 
62  struct Object {
64  std::vector<Section> Sections;
65  std::vector<Symbol> Symbols;
66  Object();
67  };
68 }
69 }
70 
73 LLVM_YAML_IS_SEQUENCE_VECTOR(COFFYAML::Relocation)
74 
75 namespace llvm {
76 namespace yaml {
77 
78 template <>
80  static void enumeration(IO &IO, COFF::MachineTypes &Value);
81 };
82 
83 template <>
85  static void enumeration(IO &IO, COFF::SymbolBaseType &Value);
86 };
87 
88 template <>
90  static void enumeration(IO &IO, COFF::SymbolStorageClass &Value);
91 };
92 
93 template <>
95  static void enumeration(IO &IO, COFF::SymbolComplexType &Value);
96 };
97 
98 template <>
100  static void enumeration(IO &IO, COFF::RelocationTypeX86 &Value);
101 };
102 
103 template <>
105  static void bitset(IO &IO, COFF::Characteristics &Value);
106 };
107 
108 template <>
109 struct ScalarBitSetTraits<COFF::SectionCharacteristics> {
110  static void bitset(IO &IO, COFF::SectionCharacteristics &Value);
111 };
112 
113 template <>
114 struct MappingTraits<COFFYAML::Relocation> {
115  static void mapping(IO &IO, COFFYAML::Relocation &Rel);
116 };
117 
118 template <>
119 struct MappingTraits<COFF::header> {
120  static void mapping(IO &IO, COFF::header &H);
121 };
122 
123 template <>
124 struct MappingTraits<COFFYAML::Symbol> {
125  static void mapping(IO &IO, COFFYAML::Symbol &S);
126 };
127 
128 template <>
129 struct MappingTraits<COFFYAML::Section> {
130  static void mapping(IO &IO, COFFYAML::Section &Sec);
131 };
132 
133 template <>
134 struct MappingTraits<COFFYAML::Object> {
135  static void mapping(IO &IO, COFFYAML::Object &Obj);
136 };
137 
138 } // end namespace yaml
139 } // end namespace llvm
140 
141 #endif
COFF::section Header
Definition: COFFYAML.h:45
COFF::SymbolBaseType SimpleType
Definition: COFFYAML.h:55
COFF::symbol Header
Definition: COFFYAML.h:54
#define LLVM_YAML_IS_SEQUENCE_VECTOR(_type)
Definition: YAMLTraits.h:1050
Characteristics operator|(Characteristics a, Characteristics b)
Definition: COFFYAML.h:23
COFF::header Header
Definition: COFFYAML.h:63
Specialized YAMLIO scalar type for representing a binary blob.
Definition: YAML.h:64
std::vector< Relocation > Relocations
Definition: COFFYAML.h:48
std::vector< Section > Sections
Definition: COFFYAML.h:64
#define H(x, y, z)
Definition: MD5.cpp:53
object::yaml::BinaryRef AuxiliaryData
Definition: COFFYAML.h:57
SymbolStorageClass
Storage class tells where and what the symbol represents.
Definition: Support/COFF.h:147
LLVM Value Representation.
Definition: Value.h:66
std::vector< Symbol > Symbols
Definition: COFFYAML.h:65
COFF::SymbolComplexType ComplexType
Definition: COFFYAML.h:56
COFF::SectionCharacteristics Characteristics
Definition: COFFYAML.cpp:196
object::yaml::BinaryRef SectionData
Definition: COFFYAML.h:47