diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-05-31 20:26:44 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-05-31 20:26:44 +0000 |
commit | 05bc4a6f20fb4bad971dc6ebb86b9ee29307bd3d (patch) | |
tree | 689fc46d860140b2305957bac56bfc2073fdeb3b /lib/Object | |
parent | 47afc19625e97a3716d813f014a3a48468e591ca (diff) | |
download | external_llvm-05bc4a6f20fb4bad971dc6ebb86b9ee29307bd3d.zip external_llvm-05bc4a6f20fb4bad971dc6ebb86b9ee29307bd3d.tar.gz external_llvm-05bc4a6f20fb4bad971dc6ebb86b9ee29307bd3d.tar.bz2 |
Don't allocate temporary string for section data.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183040 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Object')
-rw-r--r-- | lib/Object/COFFYAML.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/Object/COFFYAML.cpp b/lib/Object/COFFYAML.cpp index 7a15452..0ece09f 100644 --- a/lib/Object/COFFYAML.cpp +++ b/lib/Object/COFFYAML.cpp @@ -229,6 +229,23 @@ 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); |