From c6c0e54d3d69ac297f0a0bb03bc0b5e792f85e12 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Wed, 7 Dec 2016 18:52:59 +0000 Subject: [ObjectYAML] Support for DWARF __debug_abbrev section This patch adds support for round-tripping DWARF debug abbreviations through the obj<->yaml tools. llvm-svn: 288955 --- llvm/lib/ObjectYAML/MachOYAML.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'llvm/lib/ObjectYAML/MachOYAML.cpp') diff --git a/llvm/lib/ObjectYAML/MachOYAML.cpp b/llvm/lib/ObjectYAML/MachOYAML.cpp index d3f8ea47e59..45554304d10 100644 --- a/llvm/lib/ObjectYAML/MachOYAML.cpp +++ b/llvm/lib/ObjectYAML/MachOYAML.cpp @@ -30,7 +30,7 @@ bool MachOYAML::LinkEditData::isEmpty() const { } bool MachOYAML::DWARFData::isEmpty() const { - return 0 == DebugStrings.size(); + return 0 == DebugStrings.size() + AbbrevDecls.size(); } namespace yaml { @@ -559,7 +559,22 @@ void MappingTraits::mapping( void MappingTraits::mapping( IO &IO, MachOYAML::DWARFData &DWARF) { - IO.mapRequired("DebugStrings", DWARF.DebugStrings); + IO.mapOptional("DebugStrings", DWARF.DebugStrings); + IO.mapOptional("AbbrevDecls", DWARF.AbbrevDecls); +} + +void MappingTraits::mapping( + IO &IO, MachOYAML::DWARFAbbrev &Abbrev) { + IO.mapRequired("Code", Abbrev.Code); + IO.mapRequired("Tag", Abbrev.Tag); + IO.mapRequired("Children", Abbrev.Children); + IO.mapRequired("Attributes", Abbrev.Attributes); +} + +void MappingTraits::mapping( + IO &IO, MachOYAML::DWARFAttributeAbbrev &AttAbbrev) { + IO.mapRequired("Attribute", AttAbbrev.Attribute); + IO.mapRequired("Form", AttAbbrev.Form); } } // namespace llvm::yaml -- cgit v1.2.3