Support/ConvertUTF: implement U+FFFD insertion according to the recommendation
[oota-llvm.git] / include / llvm / Object / COFFYAML.h
index 7e8aefa0500ccfec418135a1df82cb2b21ee4318..3f48e07f575a33231e2b5fa77af4f406a42b6a5d 100644 (file)
@@ -14,6 +14,7 @@
 #ifndef LLVM_OBJECT_COFFYAML_H
 #define LLVM_OBJECT_COFFYAML_H
 
+#include "llvm/ADT/Optional.h"
 #include "llvm/Object/YAML.h"
 #include "llvm/Support/COFF.h"
 
@@ -35,11 +36,21 @@ inline SectionCharacteristics operator|(SectionCharacteristics a,
 // The structure of the yaml files is not an exact 1:1 match to COFF. In order
 // to use yaml::IO, we use these structures which are closer to the source.
 namespace COFFYAML {
+  LLVM_YAML_STRONG_TYPEDEF(uint8_t, COMDATType)
+  LLVM_YAML_STRONG_TYPEDEF(uint32_t, WeakExternalCharacteristics)
+  LLVM_YAML_STRONG_TYPEDEF(uint8_t, AuxSymbolType)
+
+  struct Relocation {
+    uint32_t VirtualAddress;
+    uint16_t Type;
+    StringRef SymbolName;
+  };
+
   struct Section {
     COFF::section Header;
     unsigned Alignment;
     object::yaml::BinaryRef SectionData;
-    std::vector<COFF::relocation> Relocations;
+    std::vector<Relocation> Relocations;
     StringRef Name;
     Section();
   };
@@ -48,7 +59,12 @@ namespace COFFYAML {
     COFF::symbol Header;
     COFF::SymbolBaseType SimpleType;
     COFF::SymbolComplexType ComplexType;
-    object::yaml::BinaryRef AuxiliaryData;
+    Optional<COFF::AuxiliaryFunctionDefinition> FunctionDefinition;
+    Optional<COFF::AuxiliarybfAndefSymbol> bfAndefSymbol;
+    Optional<COFF::AuxiliaryWeakExternal> WeakExternal;
+    StringRef File;
+    Optional<COFF::AuxiliarySectionDefinition> SectionDefinition;
+    Optional<COFF::AuxiliaryCLRToken> CLRToken;
     StringRef Name;
     Symbol();
   };
@@ -64,11 +80,26 @@ namespace COFFYAML {
 
 LLVM_YAML_IS_SEQUENCE_VECTOR(COFFYAML::Section)
 LLVM_YAML_IS_SEQUENCE_VECTOR(COFFYAML::Symbol)
-LLVM_YAML_IS_SEQUENCE_VECTOR(COFF::relocation)
+LLVM_YAML_IS_SEQUENCE_VECTOR(COFFYAML::Relocation)
 
 namespace llvm {
 namespace yaml {
 
+template <>
+struct ScalarEnumerationTraits<COFFYAML::WeakExternalCharacteristics> {
+  static void enumeration(IO &IO, COFFYAML::WeakExternalCharacteristics &Value);
+};
+
+template <>
+struct ScalarEnumerationTraits<COFFYAML::AuxSymbolType> {
+  static void enumeration(IO &IO, COFFYAML::AuxSymbolType &Value);
+};
+
+template <>
+struct ScalarEnumerationTraits<COFFYAML::COMDATType> {
+  static void enumeration(IO &IO, COFFYAML::COMDATType &Value);
+};
+
 template <>
 struct ScalarEnumerationTraits<COFF::MachineTypes> {
   static void enumeration(IO &IO, COFF::MachineTypes &Value);
@@ -90,8 +121,13 @@ struct ScalarEnumerationTraits<COFF::SymbolComplexType> {
 };
 
 template <>
-struct ScalarEnumerationTraits<COFF::RelocationTypeX86> {
-  static void enumeration(IO &IO, COFF::RelocationTypeX86 &Value);
+struct ScalarEnumerationTraits<COFF::RelocationTypeI386> {
+  static void enumeration(IO &IO, COFF::RelocationTypeI386 &Value);
+};
+
+template <>
+struct ScalarEnumerationTraits<COFF::RelocationTypeAMD64> {
+  static void enumeration(IO &IO, COFF::RelocationTypeAMD64 &Value);
 };
 
 template <>
@@ -105,8 +141,8 @@ struct ScalarBitSetTraits<COFF::SectionCharacteristics> {
 };
 
 template <>
-struct MappingTraits<COFF::relocation> {
-  static void mapping(IO &IO, COFF::relocation &Rel);
+struct MappingTraits<COFFYAML::Relocation> {
+  static void mapping(IO &IO, COFFYAML::Relocation &Rel);
 };
 
 template <>
@@ -114,6 +150,26 @@ struct MappingTraits<COFF::header> {
   static void mapping(IO &IO, COFF::header &H);
 };
 
+template <> struct MappingTraits<COFF::AuxiliaryFunctionDefinition> {
+  static void mapping(IO &IO, COFF::AuxiliaryFunctionDefinition &AFD);
+};
+
+template <> struct MappingTraits<COFF::AuxiliarybfAndefSymbol> {
+  static void mapping(IO &IO, COFF::AuxiliarybfAndefSymbol &AAS);
+};
+
+template <> struct MappingTraits<COFF::AuxiliaryWeakExternal> {
+  static void mapping(IO &IO, COFF::AuxiliaryWeakExternal &AWE);
+};
+
+template <> struct MappingTraits<COFF::AuxiliarySectionDefinition> {
+  static void mapping(IO &IO, COFF::AuxiliarySectionDefinition &ASD);
+};
+
+template <> struct MappingTraits<COFF::AuxiliaryCLRToken> {
+  static void mapping(IO &IO, COFF::AuxiliaryCLRToken &ACT);
+};
+
 template <>
 struct MappingTraits<COFFYAML::Symbol> {
   static void mapping(IO &IO, COFFYAML::Symbol &S);