LCOV - code coverage report
Current view: top level - lib/ObjectYAML - MachOYAML.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 258 378 68.3 %
Date: 2017-09-14 15:23:50 Functions: 39 63 61.9 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- MachOYAML.cpp - MachO YAMLIO implementation ------------------------===//
       2             : //
       3             : //                     The LLVM Compiler Infrastructure
       4             : //
       5             : // This file is distributed under the University of Illinois Open Source
       6             : // License. See LICENSE.TXT for details.
       7             : //
       8             : //===----------------------------------------------------------------------===//
       9             : //
      10             : // This file defines classes for handling the YAML representation of MachO.
      11             : //
      12             : //===----------------------------------------------------------------------===//
      13             : 
      14             : #include "llvm/ObjectYAML/MachOYAML.h"
      15             : #include "llvm/ADT/StringRef.h"
      16             : #include "llvm/BinaryFormat/MachO.h"
      17             : #include "llvm/Support/Format.h"
      18             : #include "llvm/Support/Host.h"
      19             : #include "llvm/Support/YAMLTraits.h"
      20             : #include "llvm/Support/raw_ostream.h"
      21             : #include <cinttypes>
      22             : #include <cstdint>
      23             : #include <cstring>
      24             : 
      25             : namespace llvm {
      26             : 
      27             : MachOYAML::LoadCommand::~LoadCommand() = default;
      28             : 
      29          69 : bool MachOYAML::LinkEditData::isEmpty() const {
      30             :   return 0 ==
      31         345 :          RebaseOpcodes.size() + BindOpcodes.size() + WeakBindOpcodes.size() +
      32         276 :              LazyBindOpcodes.size() + ExportTrie.Children.size() +
      33         207 :              NameList.size() + StringTable.size();
      34             : }
      35             : 
      36             : namespace yaml {
      37             : 
      38         606 : void ScalarTraits<char_16>::output(const char_16 &Val, void *,
      39             :                                    raw_ostream &Out) {
      40         606 :   auto Len = strnlen(&Val[0], 16);
      41        1212 :   Out << StringRef(&Val[0], Len);
      42         606 : }
      43             : 
      44         516 : StringRef ScalarTraits<char_16>::input(StringRef Scalar, void *, char_16 &Val) {
      45         516 :   size_t CopySize = 16 >= Scalar.size() ? 16 : Scalar.size();
      46         516 :   memcpy((void *)Val, Scalar.data(), CopySize);
      47             : 
      48         516 :   if (Scalar.size() < 16) {
      49         482 :     memset((void *)&Val[Scalar.size()], 0, 16 - Scalar.size());
      50             :   }
      51             : 
      52         516 :   return StringRef();
      53             : }
      54             : 
      55        1122 : bool ScalarTraits<char_16>::mustQuote(StringRef S) { return needsQuotes(S); }
      56             : 
      57           9 : void ScalarTraits<uuid_t>::output(const uuid_t &Val, void *, raw_ostream &Out) {
      58           9 :   Out.write_uuid(Val);
      59           9 : }
      60             : 
      61          12 : StringRef ScalarTraits<uuid_t>::input(StringRef Scalar, void *, uuid_t &Val) {
      62          12 :   size_t OutIdx = 0;
      63         504 :   for (size_t Idx = 0; Idx < Scalar.size(); ++Idx) {
      64         528 :     if (Scalar[Idx] == '-' || OutIdx >= 16)
      65          48 :       continue;
      66             :     unsigned long long TempInt;
      67         384 :     if (getAsUnsignedInteger(Scalar.slice(Idx, Idx + 2), 16, TempInt))
      68           0 :       return "invalid number";
      69         192 :     if (TempInt > 0xFF)
      70           0 :       return "out of range number";
      71         192 :     Val[OutIdx] = static_cast<uint8_t>(TempInt);
      72         192 :     ++Idx; // increment idx an extra time because we're consuming 2 chars
      73         192 :     ++OutIdx;
      74             :   }
      75          12 :   return StringRef();
      76             : }
      77             : 
      78          21 : bool ScalarTraits<uuid_t>::mustQuote(StringRef S) { return needsQuotes(S); }
      79             : 
      80          69 : void MappingTraits<MachOYAML::FileHeader>::mapping(
      81             :     IO &IO, MachOYAML::FileHeader &FileHdr) {
      82         138 :   IO.mapRequired("magic", FileHdr.magic);
      83         138 :   IO.mapRequired("cputype", FileHdr.cputype);
      84         138 :   IO.mapRequired("cpusubtype", FileHdr.cpusubtype);
      85         138 :   IO.mapRequired("filetype", FileHdr.filetype);
      86         138 :   IO.mapRequired("ncmds", FileHdr.ncmds);
      87         138 :   IO.mapRequired("sizeofcmds", FileHdr.sizeofcmds);
      88         138 :   IO.mapRequired("flags", FileHdr.flags);
      89         151 :   if (FileHdr.magic == MachO::MH_MAGIC_64 ||
      90          13 :       FileHdr.magic == MachO::MH_CIGAM_64)
      91          56 :     IO.mapRequired("reserved", FileHdr.reserved);
      92          69 : }
      93             : 
      94          69 : void MappingTraits<MachOYAML::Object>::mapping(IO &IO,
      95             :                                                MachOYAML::Object &Object) {
      96             :   // If the context isn't already set, tag the document as !mach-o.
      97             :   // For Fat files there will be a different tag so they can be differentiated.
      98          69 :   if (!IO.getContext()) {
      99          65 :     IO.setContext(&Object);
     100             :   }
     101         138 :   IO.mapTag("!mach-o", true);
     102         138 :   IO.mapOptional("IsLittleEndian", Object.IsLittleEndian,
     103             :                  sys::IsLittleEndianHost);
     104          69 :   Object.DWARF.IsLittleEndian = Object.IsLittleEndian;
     105             : 
     106         138 :   IO.mapRequired("FileHeader", Object.Header);
     107         138 :   IO.mapOptional("LoadCommands", Object.LoadCommands);
     108          69 :   if(!Object.LinkEdit.isEmpty() || !IO.outputting())
     109          56 :     IO.mapOptional("LinkEditData", Object.LinkEdit);
     110             : 
     111          69 :   if(!Object.DWARF.isEmpty() || !IO.outputting())
     112          48 :     IO.mapOptional("DWARF", Object.DWARF);
     113             : 
     114          69 :   if (IO.getContext() == &Object)
     115          43 :     IO.setContext(nullptr);
     116          69 : }
     117             : 
     118           2 : void MappingTraits<MachOYAML::FatHeader>::mapping(
     119             :     IO &IO, MachOYAML::FatHeader &FatHeader) {
     120           4 :   IO.mapRequired("magic", FatHeader.magic);
     121           4 :   IO.mapRequired("nfat_arch", FatHeader.nfat_arch);
     122           2 : }
     123             : 
     124           4 : void MappingTraits<MachOYAML::FatArch>::mapping(IO &IO,
     125             :                                                 MachOYAML::FatArch &FatArch) {
     126           8 :   IO.mapRequired("cputype", FatArch.cputype);
     127           8 :   IO.mapRequired("cpusubtype", FatArch.cpusubtype);
     128           8 :   IO.mapRequired("offset", FatArch.offset);
     129           8 :   IO.mapRequired("size", FatArch.size);
     130           8 :   IO.mapRequired("align", FatArch.align);
     131           8 :   IO.mapOptional("reserved", FatArch.reserved,
     132           8 :                  static_cast<llvm::yaml::Hex32>(0));
     133           4 : }
     134             : 
     135           2 : void MappingTraits<MachOYAML::UniversalBinary>::mapping(
     136             :     IO &IO, MachOYAML::UniversalBinary &UniversalBinary) {
     137           2 :   if (!IO.getContext()) {
     138           2 :     IO.setContext(&UniversalBinary);
     139           4 :     IO.mapTag("!fat-mach-o", true);
     140             :   }
     141           4 :   IO.mapRequired("FatHeader", UniversalBinary.Header);
     142           4 :   IO.mapRequired("FatArchs", UniversalBinary.FatArchs);
     143           4 :   IO.mapRequired("Slices", UniversalBinary.Slices);
     144             : 
     145           2 :   if (IO.getContext() == &UniversalBinary)
     146           2 :     IO.setContext(nullptr);
     147           2 : }
     148             : 
     149          43 : void MappingTraits<MachOYAML::LinkEditData>::mapping(
     150             :     IO &IO, MachOYAML::LinkEditData &LinkEditData) {
     151          86 :   IO.mapOptional("RebaseOpcodes", LinkEditData.RebaseOpcodes);
     152          86 :   IO.mapOptional("BindOpcodes", LinkEditData.BindOpcodes);
     153          86 :   IO.mapOptional("WeakBindOpcodes", LinkEditData.WeakBindOpcodes);
     154          86 :   IO.mapOptional("LazyBindOpcodes", LinkEditData.LazyBindOpcodes);
     155          86 :   if (!LinkEditData.ExportTrie.Children.empty() || !IO.outputting())
     156          27 :     IO.mapOptional("ExportTrie", LinkEditData.ExportTrie);
     157          86 :   IO.mapOptional("NameList", LinkEditData.NameList);
     158          86 :   IO.mapOptional("StringTable", LinkEditData.StringTable);
     159          43 : }
     160             : 
     161          32 : void MappingTraits<MachOYAML::RebaseOpcode>::mapping(
     162             :     IO &IO, MachOYAML::RebaseOpcode &RebaseOpcode) {
     163          64 :   IO.mapRequired("Opcode", RebaseOpcode.Opcode);
     164          64 :   IO.mapRequired("Imm", RebaseOpcode.Imm);
     165          64 :   IO.mapOptional("ExtraData", RebaseOpcode.ExtraData);
     166          32 : }
     167             : 
     168        6075 : void MappingTraits<MachOYAML::BindOpcode>::mapping(
     169             :     IO &IO, MachOYAML::BindOpcode &BindOpcode) {
     170       12150 :   IO.mapRequired("Opcode", BindOpcode.Opcode);
     171       12150 :   IO.mapRequired("Imm", BindOpcode.Imm);
     172       12150 :   IO.mapOptional("ULEBExtraData", BindOpcode.ULEBExtraData);
     173       12150 :   IO.mapOptional("SLEBExtraData", BindOpcode.SLEBExtraData);
     174       12150 :   IO.mapOptional("Symbol", BindOpcode.Symbol);
     175        6075 : }
     176             : 
     177          31 : void MappingTraits<MachOYAML::ExportEntry>::mapping(
     178             :     IO &IO, MachOYAML::ExportEntry &ExportEntry) {
     179          62 :   IO.mapRequired("TerminalSize", ExportEntry.TerminalSize);
     180          62 :   IO.mapOptional("NodeOffset", ExportEntry.NodeOffset);
     181          62 :   IO.mapOptional("Name", ExportEntry.Name);
     182          62 :   IO.mapOptional("Flags", ExportEntry.Flags);
     183          62 :   IO.mapOptional("Address", ExportEntry.Address);
     184          62 :   IO.mapOptional("Other", ExportEntry.Other);
     185          62 :   IO.mapOptional("ImportName", ExportEntry.ImportName);
     186          62 :   IO.mapOptional("Children", ExportEntry.Children);
     187          31 : }
     188             : 
     189         373 : void MappingTraits<MachOYAML::NListEntry>::mapping(
     190             :     IO &IO, MachOYAML::NListEntry &NListEntry) {
     191         746 :   IO.mapRequired("n_strx", NListEntry.n_strx);
     192         746 :   IO.mapRequired("n_type", NListEntry.n_type);
     193         746 :   IO.mapRequired("n_sect", NListEntry.n_sect);
     194         746 :   IO.mapRequired("n_desc", NListEntry.n_desc);
     195         746 :   IO.mapRequired("n_value", NListEntry.n_value);
     196         373 : }
     197             : 
     198             : template <typename StructType>
     199             : void mapLoadCommandData(IO &IO, MachOYAML::LoadCommand &LoadCommand) {}
     200             : 
     201             : template <>
     202          19 : void mapLoadCommandData<MachO::segment_command>(
     203             :     IO &IO, MachOYAML::LoadCommand &LoadCommand) {
     204          38 :   IO.mapOptional("Sections", LoadCommand.Sections);
     205          19 : }
     206             : 
     207             : template <>
     208         153 : void mapLoadCommandData<MachO::segment_command_64>(
     209             :     IO &IO, MachOYAML::LoadCommand &LoadCommand) {
     210         306 :   IO.mapOptional("Sections", LoadCommand.Sections);
     211         153 : }
     212             : 
     213             : template <>
     214          33 : void mapLoadCommandData<MachO::dylib_command>(
     215             :     IO &IO, MachOYAML::LoadCommand &LoadCommand) {
     216          66 :   IO.mapOptional("PayloadString", LoadCommand.PayloadString);
     217          33 : }
     218             : 
     219             : template <>
     220           0 : void mapLoadCommandData<MachO::rpath_command>(
     221             :     IO &IO, MachOYAML::LoadCommand &LoadCommand) {
     222           0 :   IO.mapOptional("PayloadString", LoadCommand.PayloadString);
     223           0 : }
     224             : 
     225             : template <>
     226          19 : void mapLoadCommandData<MachO::dylinker_command>(
     227             :     IO &IO, MachOYAML::LoadCommand &LoadCommand) {
     228          38 :   IO.mapOptional("PayloadString", LoadCommand.PayloadString);
     229          19 : }
     230             : 
     231             : template <>
     232           2 : void mapLoadCommandData<MachO::build_version_command>(
     233             :     IO &IO, MachOYAML::LoadCommand &LoadCommand) {
     234           4 :   IO.mapOptional("Tools", LoadCommand.Tools);
     235           2 : }
     236             : 
     237         439 : void MappingTraits<MachOYAML::LoadCommand>::mapping(
     238             :     IO &IO, MachOYAML::LoadCommand &LoadCommand) {
     239         439 :   MachO::LoadCommandType TempCmd = static_cast<MachO::LoadCommandType>(
     240         439 :       LoadCommand.Data.load_command_data.cmd);
     241         439 :   IO.mapRequired("cmd", TempCmd);
     242         439 :   LoadCommand.Data.load_command_data.cmd = TempCmd;
     243         878 :   IO.mapRequired("cmdsize", LoadCommand.Data.load_command_data.cmdsize);
     244             : 
     245             : #define HANDLE_LOAD_COMMAND(LCName, LCValue, LCStruct)                         \
     246             :   case MachO::LCName:                                                          \
     247             :     MappingTraits<MachO::LCStruct>::mapping(IO,                                \
     248             :                                             LoadCommand.Data.LCStruct##_data); \
     249             :     mapLoadCommandData<MachO::LCStruct>(IO, LoadCommand);                      \
     250             :     break;
     251             : 
     252         439 :   switch (LoadCommand.Data.load_command_data.cmd) {
     253             : #include "llvm/BinaryFormat/MachO.def"
     254             :   }
     255         878 :   IO.mapOptional("PayloadBytes", LoadCommand.PayloadBytes);
     256         878 :   IO.mapOptional("ZeroPadBytes", LoadCommand.ZeroPadBytes, (uint64_t)0ull);
     257         439 : }
     258             : 
     259          25 : void MappingTraits<MachO::dyld_info_command>::mapping(
     260             :     IO &IO, MachO::dyld_info_command &LoadCommand) {
     261          50 :   IO.mapRequired("rebase_off", LoadCommand.rebase_off);
     262          50 :   IO.mapRequired("rebase_size", LoadCommand.rebase_size);
     263          50 :   IO.mapRequired("bind_off", LoadCommand.bind_off);
     264          50 :   IO.mapRequired("bind_size", LoadCommand.bind_size);
     265          50 :   IO.mapRequired("weak_bind_off", LoadCommand.weak_bind_off);
     266          50 :   IO.mapRequired("weak_bind_size", LoadCommand.weak_bind_size);
     267          50 :   IO.mapRequired("lazy_bind_off", LoadCommand.lazy_bind_off);
     268          50 :   IO.mapRequired("lazy_bind_size", LoadCommand.lazy_bind_size);
     269          50 :   IO.mapRequired("export_off", LoadCommand.export_off);
     270          50 :   IO.mapRequired("export_size", LoadCommand.export_size);
     271          25 : }
     272             : 
     273         475 : void MappingTraits<MachOYAML::Section>::mapping(IO &IO,
     274             :                                                 MachOYAML::Section &Section) {
     275         950 :   IO.mapRequired("sectname", Section.sectname);
     276         950 :   IO.mapRequired("segname", Section.segname);
     277         950 :   IO.mapRequired("addr", Section.addr);
     278         950 :   IO.mapRequired("size", Section.size);
     279         950 :   IO.mapRequired("offset", Section.offset);
     280         950 :   IO.mapRequired("align", Section.align);
     281         950 :   IO.mapRequired("reloff", Section.reloff);
     282         950 :   IO.mapRequired("nreloc", Section.nreloc);
     283         950 :   IO.mapRequired("flags", Section.flags);
     284         950 :   IO.mapRequired("reserved1", Section.reserved1);
     285         950 :   IO.mapRequired("reserved2", Section.reserved2);
     286         950 :   IO.mapOptional("reserved3", Section.reserved3);
     287         475 : }
     288             : 
     289           2 : void MappingTraits<MachO::build_tool_version>::mapping(
     290             :     IO &IO, MachO::build_tool_version &tool) {
     291           4 :   IO.mapRequired("tool", tool.tool);
     292           4 :   IO.mapRequired("version", tool.version);
     293           2 : }
     294             : 
     295          33 : void MappingTraits<MachO::dylib>::mapping(IO &IO, MachO::dylib &DylibStruct) {
     296          66 :   IO.mapRequired("name", DylibStruct.name);
     297          66 :   IO.mapRequired("timestamp", DylibStruct.timestamp);
     298          66 :   IO.mapRequired("current_version", DylibStruct.current_version);
     299          66 :   IO.mapRequired("compatibility_version", DylibStruct.compatibility_version);
     300          33 : }
     301             : 
     302          33 : void MappingTraits<MachO::dylib_command>::mapping(
     303             :     IO &IO, MachO::dylib_command &LoadCommand) {
     304          66 :   IO.mapRequired("dylib", LoadCommand.dylib);
     305          33 : }
     306             : 
     307          19 : void MappingTraits<MachO::dylinker_command>::mapping(
     308             :     IO &IO, MachO::dylinker_command &LoadCommand) {
     309          38 :   IO.mapRequired("name", LoadCommand.name);
     310          19 : }
     311             : 
     312          31 : void MappingTraits<MachO::dysymtab_command>::mapping(
     313             :     IO &IO, MachO::dysymtab_command &LoadCommand) {
     314          62 :   IO.mapRequired("ilocalsym", LoadCommand.ilocalsym);
     315          62 :   IO.mapRequired("nlocalsym", LoadCommand.nlocalsym);
     316          62 :   IO.mapRequired("iextdefsym", LoadCommand.iextdefsym);
     317          62 :   IO.mapRequired("nextdefsym", LoadCommand.nextdefsym);
     318          62 :   IO.mapRequired("iundefsym", LoadCommand.iundefsym);
     319          62 :   IO.mapRequired("nundefsym", LoadCommand.nundefsym);
     320          62 :   IO.mapRequired("tocoff", LoadCommand.tocoff);
     321          62 :   IO.mapRequired("ntoc", LoadCommand.ntoc);
     322          62 :   IO.mapRequired("modtaboff", LoadCommand.modtaboff);
     323          62 :   IO.mapRequired("nmodtab", LoadCommand.nmodtab);
     324          62 :   IO.mapRequired("extrefsymoff", LoadCommand.extrefsymoff);
     325          62 :   IO.mapRequired("nextrefsyms", LoadCommand.nextrefsyms);
     326          62 :   IO.mapRequired("indirectsymoff", LoadCommand.indirectsymoff);
     327          62 :   IO.mapRequired("nindirectsyms", LoadCommand.nindirectsyms);
     328          62 :   IO.mapRequired("extreloff", LoadCommand.extreloff);
     329          62 :   IO.mapRequired("nextrel", LoadCommand.nextrel);
     330          62 :   IO.mapRequired("locreloff", LoadCommand.locreloff);
     331          62 :   IO.mapRequired("nlocrel", LoadCommand.nlocrel);
     332          31 : }
     333             : 
     334           0 : void MappingTraits<MachO::encryption_info_command>::mapping(
     335             :     IO &IO, MachO::encryption_info_command &LoadCommand) {
     336           0 :   IO.mapRequired("cryptoff", LoadCommand.cryptoff);
     337           0 :   IO.mapRequired("cryptsize", LoadCommand.cryptsize);
     338           0 :   IO.mapRequired("cryptid", LoadCommand.cryptid);
     339           0 : }
     340             : 
     341           0 : void MappingTraits<MachO::encryption_info_command_64>::mapping(
     342             :     IO &IO, MachO::encryption_info_command_64 &LoadCommand) {
     343           0 :   IO.mapRequired("cryptoff", LoadCommand.cryptoff);
     344           0 :   IO.mapRequired("cryptsize", LoadCommand.cryptsize);
     345           0 :   IO.mapRequired("cryptid", LoadCommand.cryptid);
     346           0 :   IO.mapRequired("pad", LoadCommand.pad);
     347           0 : }
     348             : 
     349          17 : void MappingTraits<MachO::entry_point_command>::mapping(
     350             :     IO &IO, MachO::entry_point_command &LoadCommand) {
     351          34 :   IO.mapRequired("entryoff", LoadCommand.entryoff);
     352          34 :   IO.mapRequired("stacksize", LoadCommand.stacksize);
     353          17 : }
     354             : 
     355           0 : void MappingTraits<MachO::fvmfile_command>::mapping(
     356             :     IO &IO, MachO::fvmfile_command &LoadCommand) {
     357           0 :   IO.mapRequired("name", LoadCommand.name);
     358           0 :   IO.mapRequired("header_addr", LoadCommand.header_addr);
     359           0 : }
     360             : 
     361           0 : void MappingTraits<MachO::fvmlib>::mapping(IO &IO, MachO::fvmlib &FVMLib) {
     362           0 :   IO.mapRequired("name", FVMLib.name);
     363           0 :   IO.mapRequired("minor_version", FVMLib.minor_version);
     364           0 :   IO.mapRequired("header_addr", FVMLib.header_addr);
     365           0 : }
     366             : 
     367           0 : void MappingTraits<MachO::fvmlib_command>::mapping(
     368             :     IO &IO, MachO::fvmlib_command &LoadCommand) {
     369           0 :   IO.mapRequired("fvmlib", LoadCommand.fvmlib);
     370           0 : }
     371             : 
     372           0 : void MappingTraits<MachO::ident_command>::mapping(
     373           0 :     IO &IO, MachO::ident_command &LoadCommand) {}
     374             : 
     375          34 : void MappingTraits<MachO::linkedit_data_command>::mapping(
     376             :     IO &IO, MachO::linkedit_data_command &LoadCommand) {
     377          68 :   IO.mapRequired("dataoff", LoadCommand.dataoff);
     378          68 :   IO.mapRequired("datasize", LoadCommand.datasize);
     379          34 : }
     380             : 
     381           0 : void MappingTraits<MachO::linker_option_command>::mapping(
     382             :     IO &IO, MachO::linker_option_command &LoadCommand) {
     383           0 :   IO.mapRequired("count", LoadCommand.count);
     384           0 : }
     385             : 
     386           0 : void MappingTraits<MachO::prebind_cksum_command>::mapping(
     387             :     IO &IO, MachO::prebind_cksum_command &LoadCommand) {
     388           0 :   IO.mapRequired("cksum", LoadCommand.cksum);
     389           0 : }
     390             : 
     391           0 : void MappingTraits<MachO::load_command>::mapping(
     392           0 :     IO &IO, MachO::load_command &LoadCommand) {}
     393             : 
     394           0 : void MappingTraits<MachO::prebound_dylib_command>::mapping(
     395             :     IO &IO, MachO::prebound_dylib_command &LoadCommand) {
     396           0 :   IO.mapRequired("name", LoadCommand.name);
     397           0 :   IO.mapRequired("nmodules", LoadCommand.nmodules);
     398           0 :   IO.mapRequired("linked_modules", LoadCommand.linked_modules);
     399           0 : }
     400             : 
     401           0 : void MappingTraits<MachO::routines_command>::mapping(
     402             :     IO &IO, MachO::routines_command &LoadCommand) {
     403           0 :   IO.mapRequired("init_address", LoadCommand.init_address);
     404           0 :   IO.mapRequired("init_module", LoadCommand.init_module);
     405           0 :   IO.mapRequired("reserved1", LoadCommand.reserved1);
     406           0 :   IO.mapRequired("reserved2", LoadCommand.reserved2);
     407           0 :   IO.mapRequired("reserved3", LoadCommand.reserved3);
     408           0 :   IO.mapRequired("reserved4", LoadCommand.reserved4);
     409           0 :   IO.mapRequired("reserved5", LoadCommand.reserved5);
     410           0 :   IO.mapRequired("reserved6", LoadCommand.reserved6);
     411           0 : }
     412             : 
     413           0 : void MappingTraits<MachO::routines_command_64>::mapping(
     414             :     IO &IO, MachO::routines_command_64 &LoadCommand) {
     415           0 :   IO.mapRequired("init_address", LoadCommand.init_address);
     416           0 :   IO.mapRequired("init_module", LoadCommand.init_module);
     417           0 :   IO.mapRequired("reserved1", LoadCommand.reserved1);
     418           0 :   IO.mapRequired("reserved2", LoadCommand.reserved2);
     419           0 :   IO.mapRequired("reserved3", LoadCommand.reserved3);
     420           0 :   IO.mapRequired("reserved4", LoadCommand.reserved4);
     421           0 :   IO.mapRequired("reserved5", LoadCommand.reserved5);
     422           0 :   IO.mapRequired("reserved6", LoadCommand.reserved6);
     423           0 : }
     424             : 
     425           0 : void MappingTraits<MachO::rpath_command>::mapping(
     426             :     IO &IO, MachO::rpath_command &LoadCommand) {
     427           0 :   IO.mapRequired("path", LoadCommand.path);
     428           0 : }
     429             : 
     430           0 : void MappingTraits<MachO::section>::mapping(IO &IO, MachO::section &Section) {
     431           0 :   IO.mapRequired("sectname", Section.sectname);
     432           0 :   IO.mapRequired("segname", Section.segname);
     433           0 :   IO.mapRequired("addr", Section.addr);
     434           0 :   IO.mapRequired("size", Section.size);
     435           0 :   IO.mapRequired("offset", Section.offset);
     436           0 :   IO.mapRequired("align", Section.align);
     437           0 :   IO.mapRequired("reloff", Section.reloff);
     438           0 :   IO.mapRequired("nreloc", Section.nreloc);
     439           0 :   IO.mapRequired("flags", Section.flags);
     440           0 :   IO.mapRequired("reserved1", Section.reserved1);
     441           0 :   IO.mapRequired("reserved2", Section.reserved2);
     442           0 : }
     443             : 
     444           0 : void MappingTraits<MachO::section_64>::mapping(IO &IO,
     445             :                                                MachO::section_64 &Section) {
     446           0 :   IO.mapRequired("sectname", Section.sectname);
     447           0 :   IO.mapRequired("segname", Section.segname);
     448           0 :   IO.mapRequired("addr", Section.addr);
     449           0 :   IO.mapRequired("size", Section.size);
     450           0 :   IO.mapRequired("offset", Section.offset);
     451           0 :   IO.mapRequired("align", Section.align);
     452           0 :   IO.mapRequired("reloff", Section.reloff);
     453           0 :   IO.mapRequired("nreloc", Section.nreloc);
     454           0 :   IO.mapRequired("flags", Section.flags);
     455           0 :   IO.mapRequired("reserved1", Section.reserved1);
     456           0 :   IO.mapRequired("reserved2", Section.reserved2);
     457           0 :   IO.mapRequired("reserved3", Section.reserved3);
     458           0 : }
     459             : 
     460          19 : void MappingTraits<MachO::segment_command>::mapping(
     461             :     IO &IO, MachO::segment_command &LoadCommand) {
     462          38 :   IO.mapRequired("segname", LoadCommand.segname);
     463          38 :   IO.mapRequired("vmaddr", LoadCommand.vmaddr);
     464          38 :   IO.mapRequired("vmsize", LoadCommand.vmsize);
     465          38 :   IO.mapRequired("fileoff", LoadCommand.fileoff);
     466          38 :   IO.mapRequired("filesize", LoadCommand.filesize);
     467          38 :   IO.mapRequired("maxprot", LoadCommand.maxprot);
     468          38 :   IO.mapRequired("initprot", LoadCommand.initprot);
     469          38 :   IO.mapRequired("nsects", LoadCommand.nsects);
     470          38 :   IO.mapRequired("flags", LoadCommand.flags);
     471          19 : }
     472             : 
     473         153 : void MappingTraits<MachO::segment_command_64>::mapping(
     474             :     IO &IO, MachO::segment_command_64 &LoadCommand) {
     475         306 :   IO.mapRequired("segname", LoadCommand.segname);
     476         306 :   IO.mapRequired("vmaddr", LoadCommand.vmaddr);
     477         306 :   IO.mapRequired("vmsize", LoadCommand.vmsize);
     478         306 :   IO.mapRequired("fileoff", LoadCommand.fileoff);
     479         306 :   IO.mapRequired("filesize", LoadCommand.filesize);
     480         306 :   IO.mapRequired("maxprot", LoadCommand.maxprot);
     481         306 :   IO.mapRequired("initprot", LoadCommand.initprot);
     482         306 :   IO.mapRequired("nsects", LoadCommand.nsects);
     483         306 :   IO.mapRequired("flags", LoadCommand.flags);
     484         153 : }
     485             : 
     486          17 : void MappingTraits<MachO::source_version_command>::mapping(
     487             :     IO &IO, MachO::source_version_command &LoadCommand) {
     488          34 :   IO.mapRequired("version", LoadCommand.version);
     489          17 : }
     490             : 
     491           0 : void MappingTraits<MachO::sub_client_command>::mapping(
     492             :     IO &IO, MachO::sub_client_command &LoadCommand) {
     493           0 :   IO.mapRequired("client", LoadCommand.client);
     494           0 : }
     495             : 
     496           0 : void MappingTraits<MachO::sub_framework_command>::mapping(
     497             :     IO &IO, MachO::sub_framework_command &LoadCommand) {
     498           0 :   IO.mapRequired("umbrella", LoadCommand.umbrella);
     499           0 : }
     500             : 
     501           0 : void MappingTraits<MachO::sub_library_command>::mapping(
     502             :     IO &IO, MachO::sub_library_command &LoadCommand) {
     503           0 :   IO.mapRequired("sub_library", LoadCommand.sub_library);
     504           0 : }
     505             : 
     506           0 : void MappingTraits<MachO::sub_umbrella_command>::mapping(
     507             :     IO &IO, MachO::sub_umbrella_command &LoadCommand) {
     508           0 :   IO.mapRequired("sub_umbrella", LoadCommand.sub_umbrella);
     509           0 : }
     510             : 
     511           0 : void MappingTraits<MachO::symseg_command>::mapping(
     512             :     IO &IO, MachO::symseg_command &LoadCommand) {
     513           0 :   IO.mapRequired("offset", LoadCommand.offset);
     514           0 :   IO.mapRequired("size", LoadCommand.size);
     515           0 : }
     516             : 
     517          39 : void MappingTraits<MachO::symtab_command>::mapping(
     518             :     IO &IO, MachO::symtab_command &LoadCommand) {
     519          78 :   IO.mapRequired("symoff", LoadCommand.symoff);
     520          78 :   IO.mapRequired("nsyms", LoadCommand.nsyms);
     521          78 :   IO.mapRequired("stroff", LoadCommand.stroff);
     522          78 :   IO.mapRequired("strsize", LoadCommand.strsize);
     523          39 : }
     524             : 
     525           0 : void MappingTraits<MachO::thread_command>::mapping(
     526           0 :     IO &IO, MachO::thread_command &LoadCommand) {}
     527             : 
     528           0 : void MappingTraits<MachO::twolevel_hints_command>::mapping(
     529             :     IO &IO, MachO::twolevel_hints_command &LoadCommand) {
     530           0 :   IO.mapRequired("offset", LoadCommand.offset);
     531           0 :   IO.mapRequired("nhints", LoadCommand.nhints);
     532           0 : }
     533             : 
     534          21 : void MappingTraits<MachO::uuid_command>::mapping(
     535             :     IO &IO, MachO::uuid_command &LoadCommand) {
     536          42 :   IO.mapRequired("uuid", LoadCommand.uuid);
     537          21 : }
     538             : 
     539          25 : void MappingTraits<MachO::version_min_command>::mapping(
     540             :     IO &IO, MachO::version_min_command &LoadCommand) {
     541          50 :   IO.mapRequired("version", LoadCommand.version);
     542          50 :   IO.mapRequired("sdk", LoadCommand.sdk);
     543          25 : }
     544             : 
     545           0 : void MappingTraits<MachO::note_command>::mapping(
     546             :     IO &IO, MachO::note_command &LoadCommand) {
     547           0 :   IO.mapRequired("data_owner", LoadCommand.data_owner);
     548           0 :   IO.mapRequired("offset", LoadCommand.offset);
     549           0 :   IO.mapRequired("size", LoadCommand.size);
     550           0 : }
     551             : 
     552           2 : void MappingTraits<MachO::build_version_command>::mapping(
     553             :     IO &IO, MachO::build_version_command &LoadCommand) {
     554           4 :   IO.mapRequired("platform", LoadCommand.platform);
     555           4 :   IO.mapRequired("minos", LoadCommand.minos);
     556           4 :   IO.mapRequired("sdk", LoadCommand.sdk);
     557           4 :   IO.mapRequired("ntools", LoadCommand.ntools);
     558           2 : }
     559             : 
     560             : } // end namespace yaml
     561             : 
     562             : } // end namespace llvm

Generated by: LCOV version 1.13