From a3310e0b9e28fc09f915a3f0b37e432d4e6e6ca5 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 31 May 2013 20:26:44 +0000 Subject: Don't allocate temporary string for section data. llvm-svn: 183040 --- llvm/lib/Object/COFFYAML.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'llvm/lib/Object') diff --git a/llvm/lib/Object/COFFYAML.cpp b/llvm/lib/Object/COFFYAML.cpp index 7a154525e2a..0ece09f460b 100644 --- a/llvm/lib/Object/COFFYAML.cpp +++ b/llvm/lib/Object/COFFYAML.cpp @@ -229,6 +229,23 @@ struct NType { } +void ScalarTraits::output(const COFFYAML::BinaryRef &Val, + void *, llvm::raw_ostream &Out) { + ArrayRef Data = Val.getBinary(); + for (ArrayRef::iterator I = Data.begin(), E = Data.end(); I != E; + ++I) { + uint8_t Byte = *I; + Out << hexdigit(Byte >> 4); + Out << hexdigit(Byte & 0xf); + } +} + +StringRef ScalarTraits::input(StringRef Scalar, void *, + COFFYAML::BinaryRef &Val) { + Val = COFFYAML::BinaryRef(Scalar); + return StringRef(); +} + void MappingTraits::mapping(IO &IO, COFF::relocation &Rel) { MappingNormalization NT(IO, Rel.Type); -- cgit v1.2.3