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

Generated by: LCOV version 1.13