Chris Bieneman | 79e60eb | 2016-12-07 21:26:32 +0000 | [diff] [blame] | 1 | //===- DWARFYAML.cpp - DWARF 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 DWARF Debug |
| 11 | // Info. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #include "llvm/ObjectYAML/DWARFYAML.h" |
| 16 | |
| 17 | namespace llvm { |
| 18 | |
Chris Bieneman | fbf7dfe | 2016-12-08 17:46:57 +0000 | [diff] [blame] | 19 | bool DWARFYAML::Data::isEmpty() const { |
Chris Bieneman | 79e60eb | 2016-12-07 21:26:32 +0000 | [diff] [blame] | 20 | return 0 == DebugStrings.size() + AbbrevDecls.size(); |
| 21 | } |
| 22 | |
| 23 | namespace yaml { |
| 24 | |
Chris Bieneman | fbf7dfe | 2016-12-08 17:46:57 +0000 | [diff] [blame] | 25 | void MappingTraits<DWARFYAML::Data>::mapping( |
| 26 | IO &IO, DWARFYAML::Data &DWARF) { |
Chris Bieneman | 79e60eb | 2016-12-07 21:26:32 +0000 | [diff] [blame] | 27 | IO.mapOptional("debug_str", DWARF.DebugStrings); |
| 28 | IO.mapOptional("debug_abbrev", DWARF.AbbrevDecls); |
Chris Bieneman | 313b326 | 2016-12-09 00:26:44 +0000 | [diff] [blame^] | 29 | if(!DWARF.ARanges.empty() || !IO.outputting()) |
| 30 | IO.mapOptional("debug_aranges", DWARF.ARanges); |
Chris Bieneman | 79e60eb | 2016-12-07 21:26:32 +0000 | [diff] [blame] | 31 | } |
| 32 | |
Chris Bieneman | fbf7dfe | 2016-12-08 17:46:57 +0000 | [diff] [blame] | 33 | void MappingTraits<DWARFYAML::Abbrev>::mapping( |
| 34 | IO &IO, DWARFYAML::Abbrev &Abbrev) { |
Chris Bieneman | 79e60eb | 2016-12-07 21:26:32 +0000 | [diff] [blame] | 35 | IO.mapRequired("Code", Abbrev.Code); |
| 36 | IO.mapRequired("Tag", Abbrev.Tag); |
| 37 | IO.mapRequired("Children", Abbrev.Children); |
| 38 | IO.mapRequired("Attributes", Abbrev.Attributes); |
| 39 | } |
| 40 | |
Chris Bieneman | fbf7dfe | 2016-12-08 17:46:57 +0000 | [diff] [blame] | 41 | void MappingTraits<DWARFYAML::AttributeAbbrev>::mapping( |
| 42 | IO &IO, DWARFYAML::AttributeAbbrev &AttAbbrev) { |
Chris Bieneman | 79e60eb | 2016-12-07 21:26:32 +0000 | [diff] [blame] | 43 | IO.mapRequired("Attribute", AttAbbrev.Attribute); |
| 44 | IO.mapRequired("Form", AttAbbrev.Form); |
| 45 | } |
| 46 | |
Chris Bieneman | 313b326 | 2016-12-09 00:26:44 +0000 | [diff] [blame^] | 47 | void MappingTraits<DWARFYAML::ARangeDescriptor>::mapping( |
| 48 | IO &IO, DWARFYAML::ARangeDescriptor &Descriptor) { |
| 49 | IO.mapRequired("Address", Descriptor.Address); |
| 50 | IO.mapRequired("Length", Descriptor.Length); |
| 51 | } |
| 52 | |
| 53 | void MappingTraits<DWARFYAML::ARange>::mapping(IO &IO, |
| 54 | DWARFYAML::ARange &Range) { |
| 55 | IO.mapRequired("Length", Range.Length); |
| 56 | IO.mapRequired("Version", Range.Version); |
| 57 | IO.mapRequired("CuOffset", Range.CuOffset); |
| 58 | IO.mapRequired("AddrSize", Range.AddrSize); |
| 59 | IO.mapRequired("SegSize", Range.SegSize); |
| 60 | IO.mapRequired("Descriptors", Range.Descriptors); |
| 61 | } |
| 62 | |
Chris Bieneman | 79e60eb | 2016-12-07 21:26:32 +0000 | [diff] [blame] | 63 | } // namespace llvm::yaml |
| 64 | |
| 65 | } // namespace llvm |