diff options
| author | Joey Gouly <joey.gouly@gmail.com> | 2014-01-03 23:12:02 +0000 |
|---|---|---|
| committer | Joey Gouly <joey.gouly@gmail.com> | 2014-01-03 23:12:02 +0000 |
| commit | ceb16dedefc7833b3f3b7305e751ad9ba748d99b (patch) | |
| tree | 7158a67f016d6a8bece0f3cf0b35fd8d62f6ce46 /lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp | |
| parent | 0724bf67672c754aa61ce2659939450ff22c30fa (diff) | |
| download | bcm5719-llvm-ceb16dedefc7833b3f3b7305e751ad9ba748d99b.tar.gz bcm5719-llvm-ceb16dedefc7833b3f3b7305e751ad9ba748d99b.zip | |
[MachO] Begin to add some MachO specific File/Atoms, and add the start of
normalizedToAtoms.
llvm-svn: 198459
Diffstat (limited to 'lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp')
| -rw-r--r-- | lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp index 2a888d5d3eb..78efae6adb8 100644 --- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp +++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp @@ -269,6 +269,7 @@ struct ScalarBitSetTraits<SymbolDesc> { template <> struct MappingTraits<Section> { + struct NormalizedContentBytes; static void mapping(IO &io, Section §) { io.mapRequired("segment", sect.segmentName); io.mapRequired("section", sect.sectionName); @@ -276,10 +277,31 @@ struct MappingTraits<Section> { io.mapOptional("attributes", sect.attributes); io.mapOptional("alignment", sect.alignment, 0U); io.mapRequired("address", sect.address); - io.mapOptional("content", sect.content); + MappingNormalization<NormalizedContent, std::vector<uint8_t>> content( + io, sect.content); + io.mapOptional("content", content->normalizedContent); io.mapOptional("relocations", sect.relocations); io.mapOptional("indirect-syms", sect.indirectSymbols); } + + // FIXME: It would be good if we could remove this, so we don't need to copy + // the content data. + struct NormalizedContent { + NormalizedContent(IO &) {} + NormalizedContent(IO &, std::vector<uint8_t> content) { + for (auto &c : content) { + normalizedContent.push_back(c); + } + } + std::vector<uint8_t> denormalize(IO &) { + std::vector<uint8_t> content; + for (auto &c : normalizedContent) { + content.push_back(c); + } + return content; + } + ContentBytes normalizedContent; + }; }; |

