From 06120815a252676ea8abfddf4f80f549ef9a9f06 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 31 May 2013 20:38:27 +0000 Subject: Rename COFFYaml.h to COFFYAML.h for consistency. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183042 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Object/COFFYAML.h | 164 +++++++++++++++++++++++++++++++++++++++++ include/llvm/Object/COFFYaml.h | 164 ----------------------------------------- lib/Object/COFFYAML.cpp | 2 +- tools/obj2yaml/coff2yaml.cpp | 2 +- tools/yaml2obj/yaml2obj.cpp | 2 +- 5 files changed, 167 insertions(+), 167 deletions(-) create mode 100644 include/llvm/Object/COFFYAML.h delete mode 100644 include/llvm/Object/COFFYaml.h diff --git a/include/llvm/Object/COFFYAML.h b/include/llvm/Object/COFFYAML.h new file mode 100644 index 0000000..25c4601 --- /dev/null +++ b/include/llvm/Object/COFFYAML.h @@ -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(a) | static_cast(b); + return static_cast(Ret); +} + +inline SectionCharacteristics operator|(SectionCharacteristics a, + SectionCharacteristics b) { + uint32_t Ret = static_cast(a) | static_cast(b); + return static_cast(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 BinaryData; + StringRef HexData; + bool isBinary; + public: + BinaryRef(ArrayRef BinaryData) + : BinaryData(BinaryData), isBinary(true) {} + BinaryRef(StringRef HexData) : HexData(HexData), isBinary(false) {} + BinaryRef() : isBinary(false) {} + StringRef getHex() const { + assert(!isBinary); + return HexData; + } + ArrayRef getBinary() const { + assert(isBinary); + return BinaryData; + } + }; + + struct Section { + COFF::section Header; + unsigned Alignment; + BinaryRef SectionData; + std::vector 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
Sections; + std::vector 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 { + static void output(const COFFYAML::BinaryRef &, void*, llvm::raw_ostream &); + static StringRef input(StringRef, void*, COFFYAML::BinaryRef &); +}; + +template <> +struct ScalarEnumerationTraits { + static void enumeration(IO &IO, COFF::MachineTypes &Value); +}; + +template <> +struct ScalarEnumerationTraits { + static void enumeration(IO &IO, COFF::SymbolBaseType &Value); +}; + +template <> +struct ScalarEnumerationTraits { + static void enumeration(IO &IO, COFF::SymbolStorageClass &Value); +}; + +template <> +struct ScalarEnumerationTraits { + static void enumeration(IO &IO, COFF::SymbolComplexType &Value); +}; + +template <> +struct ScalarEnumerationTraits { + static void enumeration(IO &IO, COFF::RelocationTypeX86 &Value); +}; + +template <> +struct ScalarBitSetTraits { + static void bitset(IO &IO, COFF::Characteristics &Value); +}; + +template <> +struct ScalarBitSetTraits { + static void bitset(IO &IO, COFF::SectionCharacteristics &Value); +}; + +template <> +struct MappingTraits { + static void mapping(IO &IO, COFF::relocation &Rel); +}; + +template <> +struct MappingTraits { + static void mapping(IO &IO, COFF::header &H); +}; + +template <> +struct MappingTraits { + static void mapping(IO &IO, COFFYAML::Symbol &S); +}; + +template <> +struct MappingTraits { + static void mapping(IO &IO, COFFYAML::Section &Sec); +}; + +template <> +struct MappingTraits { + 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 index 25c4601..0000000 --- a/include/llvm/Object/COFFYaml.h +++ /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(a) | static_cast(b); - return static_cast(Ret); -} - -inline SectionCharacteristics operator|(SectionCharacteristics a, - SectionCharacteristics b) { - uint32_t Ret = static_cast(a) | static_cast(b); - return static_cast(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 BinaryData; - StringRef HexData; - bool isBinary; - public: - BinaryRef(ArrayRef BinaryData) - : BinaryData(BinaryData), isBinary(true) {} - BinaryRef(StringRef HexData) : HexData(HexData), isBinary(false) {} - BinaryRef() : isBinary(false) {} - StringRef getHex() const { - assert(!isBinary); - return HexData; - } - ArrayRef getBinary() const { - assert(isBinary); - return BinaryData; - } - }; - - struct Section { - COFF::section Header; - unsigned Alignment; - BinaryRef SectionData; - std::vector 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
Sections; - std::vector 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 { - static void output(const COFFYAML::BinaryRef &, void*, llvm::raw_ostream &); - static StringRef input(StringRef, void*, COFFYAML::BinaryRef &); -}; - -template <> -struct ScalarEnumerationTraits { - static void enumeration(IO &IO, COFF::MachineTypes &Value); -}; - -template <> -struct ScalarEnumerationTraits { - static void enumeration(IO &IO, COFF::SymbolBaseType &Value); -}; - -template <> -struct ScalarEnumerationTraits { - static void enumeration(IO &IO, COFF::SymbolStorageClass &Value); -}; - -template <> -struct ScalarEnumerationTraits { - static void enumeration(IO &IO, COFF::SymbolComplexType &Value); -}; - -template <> -struct ScalarEnumerationTraits { - static void enumeration(IO &IO, COFF::RelocationTypeX86 &Value); -}; - -template <> -struct ScalarBitSetTraits { - static void bitset(IO &IO, COFF::Characteristics &Value); -}; - -template <> -struct ScalarBitSetTraits { - static void bitset(IO &IO, COFF::SectionCharacteristics &Value); -}; - -template <> -struct MappingTraits { - static void mapping(IO &IO, COFF::relocation &Rel); -}; - -template <> -struct MappingTraits { - static void mapping(IO &IO, COFF::header &H); -}; - -template <> -struct MappingTraits { - static void mapping(IO &IO, COFFYAML::Symbol &S); -}; - -template <> -struct MappingTraits { - static void mapping(IO &IO, COFFYAML::Section &Sec); -}; - -template <> -struct MappingTraits { - static void mapping(IO &IO, COFFYAML::Object &Obj); -}; - -} // end namespace yaml -} // end namespace llvm - -#endif diff --git a/lib/Object/COFFYAML.cpp b/lib/Object/COFFYAML.cpp index 0ece09f..f3883af 100644 --- a/lib/Object/COFFYAML.cpp +++ b/lib/Object/COFFYAML.cpp @@ -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 { diff --git a/tools/obj2yaml/coff2yaml.cpp b/tools/obj2yaml/coff2yaml.cpp index b41edc1..d1c4d01 100644 --- a/tools/obj2yaml/coff2yaml.cpp +++ b/tools/obj2yaml/coff2yaml.cpp @@ -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" diff --git a/tools/yaml2obj/yaml2obj.cpp b/tools/yaml2obj/yaml2obj.cpp index 0c285c2..ac3e4ca 100644 --- a/tools/yaml2obj/yaml2obj.cpp +++ b/tools/yaml2obj/yaml2obj.cpp @@ -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" -- cgit v1.1