aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Object/COFFYAML.h
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-06-05 02:32:26 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-06-05 02:32:26 +0000
commit5fd5fe0f7bfac0f7973475fcf7a5f8061d983538 (patch)
tree8596242c630f6f9a293d27abcda4f0c7746b806e /include/llvm/Object/COFFYAML.h
parent6afb65c2b709cfa078d0f6f6c5feceb2abab8036 (diff)
downloadexternal_llvm-5fd5fe0f7bfac0f7973475fcf7a5f8061d983538.zip
external_llvm-5fd5fe0f7bfac0f7973475fcf7a5f8061d983538.tar.gz
external_llvm-5fd5fe0f7bfac0f7973475fcf7a5f8061d983538.tar.bz2
Move BinaryRef to a new include/llvm/Object/YAML.h file.
It will be used for ELF dumping too. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183287 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Object/COFFYAML.h')
-rw-r--r--include/llvm/Object/COFFYAML.h35
1 files changed, 3 insertions, 32 deletions
diff --git a/include/llvm/Object/COFFYAML.h b/include/llvm/Object/COFFYAML.h
index 4c20260..7e8aefa 100644
--- a/include/llvm/Object/COFFYAML.h
+++ b/include/llvm/Object/COFFYAML.h
@@ -14,9 +14,8 @@
#ifndef LLVM_OBJECT_COFFYAML_H
#define LLVM_OBJECT_COFFYAML_H
-
+#include "llvm/Object/YAML.h"
#include "llvm/Support/COFF.h"
-#include "llvm/Support/YAMLTraits.h"
namespace llvm {
@@ -36,32 +35,10 @@ 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 {
- /// 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> Data;
- bool isBinary;
- public:
- BinaryRef(ArrayRef<uint8_t> Data) : Data(Data), isBinary(true) {}
- BinaryRef(StringRef Data)
- : Data(reinterpret_cast<const uint8_t *>(Data.data()), Data.size()),
- isBinary(false) {}
- BinaryRef() : isBinary(false) {}
- StringRef getHex() const {
- assert(!isBinary);
- return StringRef(reinterpret_cast<const char*>(Data.data()), Data.size());
- }
- ArrayRef<uint8_t> getBinary() const {
- assert(isBinary);
- return Data;
- }
- };
-
struct Section {
COFF::section Header;
unsigned Alignment;
- BinaryRef SectionData;
+ object::yaml::BinaryRef SectionData;
std::vector<COFF::relocation> Relocations;
StringRef Name;
Section();
@@ -71,7 +48,7 @@ namespace COFFYAML {
COFF::symbol Header;
COFF::SymbolBaseType SimpleType;
COFF::SymbolComplexType ComplexType;
- BinaryRef AuxiliaryData;
+ object::yaml::BinaryRef AuxiliaryData;
StringRef Name;
Symbol();
};
@@ -92,12 +69,6 @@ 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);