Rename COFFYaml.h to COFFYAML.h for consistency.
authorRafael Espindola <rafael.espindola@gmail.com>
Fri, 31 May 2013 20:38:27 +0000 (20:38 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Fri, 31 May 2013 20:38:27 +0000 (20:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183042 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Object/COFFYAML.h [new file with mode: 0644]
include/llvm/Object/COFFYaml.h [deleted file]
lib/Object/COFFYAML.cpp
tools/obj2yaml/coff2yaml.cpp
tools/yaml2obj/yaml2obj.cpp

diff --git a/include/llvm/Object/COFFYAML.h b/include/llvm/Object/COFFYAML.h
new file mode 100644 (file)
index 0000000..25c4601
--- /dev/null
@@ -0,0 +1,164 @@
+//===- COFFYAML.h - COFF YAMLIO implementation ------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file declares classes for handling the YAML representation of COFF.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_OBJECT_COFFYAML_H
+#define LLVM_OBJECT_COFFYAML_H
+
+
+#include "llvm/Support/COFF.h"
+#include "llvm/Support/YAMLTraits.h"
+
+namespace llvm {
+
+namespace COFF {
+inline Characteristics operator|(Characteristics a, Characteristics b) {
+  uint32_t Ret = static_cast<uint32_t>(a) | static_cast<uint32_t>(b);
+  return static_cast<Characteristics>(Ret);
+}
+
+inline SectionCharacteristics operator|(SectionCharacteristics a,
+                                        SectionCharacteristics b) {
+  uint32_t Ret = static_cast<uint32_t>(a) | static_cast<uint32_t>(b);
+  return static_cast<SectionCharacteristics>(Ret);
+}
+}
+
+// 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 {
+  /// In an object file this is just a binary blob. In an yaml file it is an hex
+  /// string. Using this avoid having to allocate temporary strings.
+  /// FIXME: not COFF specific.
+  class BinaryRef {
+    ArrayRef<uint8_t> BinaryData;
+    StringRef HexData;
+    bool isBinary;
+  public:
+    BinaryRef(ArrayRef<uint8_t> BinaryData)
+        : BinaryData(BinaryData), isBinary(true) {}
+    BinaryRef(StringRef HexData) : HexData(HexData), isBinary(false) {}
+    BinaryRef() : isBinary(false) {}
+    StringRef getHex() const {
+      assert(!isBinary);
+      return HexData;
+    }
+    ArrayRef<uint8_t> getBinary() const {
+      assert(isBinary);
+      return BinaryData;
+    }
+  };
+
+  struct Section {
+    COFF::section Header;
+    unsigned Alignment;
+    BinaryRef SectionData;
+    std::vector<COFF::relocation> Relocations;
+    StringRef Name;
+    Section();
+  };
+
+  struct Symbol {
+    COFF::symbol Header;
+    COFF::SymbolBaseType SimpleType;
+    COFF::SymbolComplexType ComplexType;
+    BinaryRef AuxiliaryData;
+    StringRef Name;
+    Symbol();
+  };
+
+  struct Object {
+    COFF::header Header;
+    std::vector<Section> Sections;
+    std::vector<Symbol> Symbols;
+    Object();
+  };
+}
+}
+
+LLVM_YAML_IS_SEQUENCE_VECTOR(COFFYAML::Section)
+LLVM_YAML_IS_SEQUENCE_VECTOR(COFFYAML::Symbol)
+LLVM_YAML_IS_SEQUENCE_VECTOR(COFF::relocation)
+
+namespace llvm {
+namespace yaml {
+
+template<>
+struct ScalarTraits<COFFYAML::BinaryRef> {
+  static void output(const COFFYAML::BinaryRef &, void*, llvm::raw_ostream &);
+  static StringRef input(StringRef, void*, COFFYAML::BinaryRef &);
+};
+
+template <>
+struct ScalarEnumerationTraits<COFF::MachineTypes> {
+  static void enumeration(IO &IO, COFF::MachineTypes &Value);
+};
+
+template <>
+struct ScalarEnumerationTraits<COFF::SymbolBaseType> {
+  static void enumeration(IO &IO, COFF::SymbolBaseType &Value);
+};
+
+template <>
+struct ScalarEnumerationTraits<COFF::SymbolStorageClass> {
+  static void enumeration(IO &IO, COFF::SymbolStorageClass &Value);
+};
+
+template <>
+struct ScalarEnumerationTraits<COFF::SymbolComplexType> {
+  static void enumeration(IO &IO, COFF::SymbolComplexType &Value);
+};
+
+template <>
+struct ScalarEnumerationTraits<COFF::RelocationTypeX86> {
+  static void enumeration(IO &IO, COFF::RelocationTypeX86 &Value);
+};
+
+template <>
+struct ScalarBitSetTraits<COFF::Characteristics> {
+  static void bitset(IO &IO, COFF::Characteristics &Value);
+};
+
+template <>
+struct ScalarBitSetTraits<COFF::SectionCharacteristics> {
+  static void bitset(IO &IO, COFF::SectionCharacteristics &Value);
+};
+
+template <>
+struct MappingTraits<COFF::relocation> {
+  static void mapping(IO &IO, COFF::relocation &Rel);
+};
+
+template <>
+struct MappingTraits<COFF::header> {
+  static void mapping(IO &IO, COFF::header &H);
+};
+
+template <>
+struct MappingTraits<COFFYAML::Symbol> {
+  static void mapping(IO &IO, COFFYAML::Symbol &S);
+};
+
+template <>
+struct MappingTraits<COFFYAML::Section> {
+  static void mapping(IO &IO, COFFYAML::Section &Sec);
+};
+
+template <>
+struct MappingTraits<COFFYAML::Object> {
+  static void mapping(IO &IO, COFFYAML::Object &Obj);
+};
+
+} // end namespace yaml
+} // end namespace llvm
+
+#endif
diff --git a/include/llvm/Object/COFFYaml.h b/include/llvm/Object/COFFYaml.h
deleted file mode 100644 (file)
index 25c4601..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-//===- COFFYAML.h - COFF YAMLIO implementation ------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file declares classes for handling the YAML representation of COFF.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_OBJECT_COFFYAML_H
-#define LLVM_OBJECT_COFFYAML_H
-
-
-#include "llvm/Support/COFF.h"
-#include "llvm/Support/YAMLTraits.h"
-
-namespace llvm {
-
-namespace COFF {
-inline Characteristics operator|(Characteristics a, Characteristics b) {
-  uint32_t Ret = static_cast<uint32_t>(a) | static_cast<uint32_t>(b);
-  return static_cast<Characteristics>(Ret);
-}
-
-inline SectionCharacteristics operator|(SectionCharacteristics a,
-                                        SectionCharacteristics b) {
-  uint32_t Ret = static_cast<uint32_t>(a) | static_cast<uint32_t>(b);
-  return static_cast<SectionCharacteristics>(Ret);
-}
-}
-
-// 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 {
-  /// In an object file this is just a binary blob. In an yaml file it is an hex
-  /// string. Using this avoid having to allocate temporary strings.
-  /// FIXME: not COFF specific.
-  class BinaryRef {
-    ArrayRef<uint8_t> BinaryData;
-    StringRef HexData;
-    bool isBinary;
-  public:
-    BinaryRef(ArrayRef<uint8_t> BinaryData)
-        : BinaryData(BinaryData), isBinary(true) {}
-    BinaryRef(StringRef HexData) : HexData(HexData), isBinary(false) {}
-    BinaryRef() : isBinary(false) {}
-    StringRef getHex() const {
-      assert(!isBinary);
-      return HexData;
-    }
-    ArrayRef<uint8_t> getBinary() const {
-      assert(isBinary);
-      return BinaryData;
-    }
-  };
-
-  struct Section {
-    COFF::section Header;
-    unsigned Alignment;
-    BinaryRef SectionData;
-    std::vector<COFF::relocation> Relocations;
-    StringRef Name;
-    Section();
-  };
-
-  struct Symbol {
-    COFF::symbol Header;
-    COFF::SymbolBaseType SimpleType;
-    COFF::SymbolComplexType ComplexType;
-    BinaryRef AuxiliaryData;
-    StringRef Name;
-    Symbol();
-  };
-
-  struct Object {
-    COFF::header Header;
-    std::vector<Section> Sections;
-    std::vector<Symbol> Symbols;
-    Object();
-  };
-}
-}
-
-LLVM_YAML_IS_SEQUENCE_VECTOR(COFFYAML::Section)
-LLVM_YAML_IS_SEQUENCE_VECTOR(COFFYAML::Symbol)
-LLVM_YAML_IS_SEQUENCE_VECTOR(COFF::relocation)
-
-namespace llvm {
-namespace yaml {
-
-template<>
-struct ScalarTraits<COFFYAML::BinaryRef> {
-  static void output(const COFFYAML::BinaryRef &, void*, llvm::raw_ostream &);
-  static StringRef input(StringRef, void*, COFFYAML::BinaryRef &);
-};
-
-template <>
-struct ScalarEnumerationTraits<COFF::MachineTypes> {
-  static void enumeration(IO &IO, COFF::MachineTypes &Value);
-};
-
-template <>
-struct ScalarEnumerationTraits<COFF::SymbolBaseType> {
-  static void enumeration(IO &IO, COFF::SymbolBaseType &Value);
-};
-
-template <>
-struct ScalarEnumerationTraits<COFF::SymbolStorageClass> {
-  static void enumeration(IO &IO, COFF::SymbolStorageClass &Value);
-};
-
-template <>
-struct ScalarEnumerationTraits<COFF::SymbolComplexType> {
-  static void enumeration(IO &IO, COFF::SymbolComplexType &Value);
-};
-
-template <>
-struct ScalarEnumerationTraits<COFF::RelocationTypeX86> {
-  static void enumeration(IO &IO, COFF::RelocationTypeX86 &Value);
-};
-
-template <>
-struct ScalarBitSetTraits<COFF::Characteristics> {
-  static void bitset(IO &IO, COFF::Characteristics &Value);
-};
-
-template <>
-struct ScalarBitSetTraits<COFF::SectionCharacteristics> {
-  static void bitset(IO &IO, COFF::SectionCharacteristics &Value);
-};
-
-template <>
-struct MappingTraits<COFF::relocation> {
-  static void mapping(IO &IO, COFF::relocation &Rel);
-};
-
-template <>
-struct MappingTraits<COFF::header> {
-  static void mapping(IO &IO, COFF::header &H);
-};
-
-template <>
-struct MappingTraits<COFFYAML::Symbol> {
-  static void mapping(IO &IO, COFFYAML::Symbol &S);
-};
-
-template <>
-struct MappingTraits<COFFYAML::Section> {
-  static void mapping(IO &IO, COFFYAML::Section &Sec);
-};
-
-template <>
-struct MappingTraits<COFFYAML::Object> {
-  static void mapping(IO &IO, COFFYAML::Object &Obj);
-};
-
-} // end namespace yaml
-} // end namespace llvm
-
-#endif
index 0ece09f460bc98c49c55f881539681bef5988889..f3883afede48481585eae14cc410958f96c57e06 100644 (file)
@@ -11,7 +11,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Object/COFFYaml.h"
+#include "llvm/Object/COFFYAML.h"
 
 #define ECase(X) IO.enumCase(Value, #X, COFF::X);
 namespace llvm {
index b41edc1e8a01ae0d56f3d98bb4ce018b791c4e24..d1c4d01b68d895668f006affea0af5cb493359c9 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "obj2yaml.h"
 #include "llvm/Object/COFF.h"
-#include "llvm/Object/COFFYaml.h"
+#include "llvm/Object/COFFYAML.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/YAMLTraits.h"
 
index 0c285c2fd8c62584b3d7e5efe9a68a476461f653..ac3e4ca062aba4525fcf764420d539c54dbcb780 100644 (file)
@@ -18,7 +18,7 @@
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringSwitch.h"
-#include "llvm/Object/COFFYaml.h"
+#include "llvm/Object/COFFYAML.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Endian.h"