summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Object')
-rw-r--r--llvm/lib/Object/CMakeLists.txt1
-rw-r--r--llvm/lib/Object/COFFYAML.cpp17
-rw-r--r--llvm/lib/Object/YAML.cpp34
3 files changed, 35 insertions, 17 deletions
diff --git a/llvm/lib/Object/CMakeLists.txt b/llvm/lib/Object/CMakeLists.txt
index 0ca0c324014..e24f78a598d 100644
--- a/llvm/lib/Object/CMakeLists.txt
+++ b/llvm/lib/Object/CMakeLists.txt
@@ -8,4 +8,5 @@ add_llvm_library(LLVMObject
MachOObjectFile.cpp
Object.cpp
ObjectFile.cpp
+ YAML.cpp
)
diff --git a/llvm/lib/Object/COFFYAML.cpp b/llvm/lib/Object/COFFYAML.cpp
index f3883afede4..6e8dad41f9a 100644
--- a/llvm/lib/Object/COFFYAML.cpp
+++ b/llvm/lib/Object/COFFYAML.cpp
@@ -229,23 +229,6 @@ struct NType {
}
-void ScalarTraits<COFFYAML::BinaryRef>::output(const COFFYAML::BinaryRef &Val,
- void *, llvm::raw_ostream &Out) {
- ArrayRef<uint8_t> Data = Val.getBinary();
- for (ArrayRef<uint8_t>::iterator I = Data.begin(), E = Data.end(); I != E;
- ++I) {
- uint8_t Byte = *I;
- Out << hexdigit(Byte >> 4);
- Out << hexdigit(Byte & 0xf);
- }
-}
-
-StringRef ScalarTraits<COFFYAML::BinaryRef>::input(StringRef Scalar, void *,
- COFFYAML::BinaryRef &Val) {
- Val = COFFYAML::BinaryRef(Scalar);
- return StringRef();
-}
-
void MappingTraits<COFF::relocation>::mapping(IO &IO, COFF::relocation &Rel) {
MappingNormalization<NType, uint16_t> NT(IO, Rel.Type);
diff --git a/llvm/lib/Object/YAML.cpp b/llvm/lib/Object/YAML.cpp
new file mode 100644
index 00000000000..36b19974b0e
--- /dev/null
+++ b/llvm/lib/Object/YAML.cpp
@@ -0,0 +1,34 @@
+//===- YAML.cpp - YAMLIO utilities for object files -----------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines utility classes for handling the YAML representation of
+// object files.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Object/YAML.h"
+
+using namespace llvm;
+
+void yaml::ScalarTraits<object::yaml::BinaryRef>::output(
+ const object::yaml::BinaryRef &Val, void *, llvm::raw_ostream &Out) {
+ ArrayRef<uint8_t> Data = Val.getBinary();
+ for (ArrayRef<uint8_t>::iterator I = Data.begin(), E = Data.end(); I != E;
+ ++I) {
+ uint8_t Byte = *I;
+ Out << hexdigit(Byte >> 4);
+ Out << hexdigit(Byte & 0xf);
+ }
+}
+
+StringRef yaml::ScalarTraits<object::yaml::BinaryRef>::input(
+ StringRef Scalar, void *, object::yaml::BinaryRef &Val) {
+ Val = object::yaml::BinaryRef(Scalar);
+ return StringRef();
+}
OpenPOWER on IntegriCloud