diff options
author | Chris Bieneman <beanz@apple.com> | 2016-12-07 21:26:32 +0000 |
---|---|---|
committer | Chris Bieneman <beanz@apple.com> | 2016-12-07 21:26:32 +0000 |
commit | 79e60eb94880f5beac5c69fb2e42393fec6c279b (patch) | |
tree | afe760a9a3b99db858b9b27453896ae45c4381c4 /llvm/lib/ObjectYAML | |
parent | 50db7f416c5442a4b033628b7ef73377f621f7ec (diff) | |
download | bcm5719-llvm-79e60eb94880f5beac5c69fb2e42393fec6c279b.tar.gz bcm5719-llvm-79e60eb94880f5beac5c69fb2e42393fec6c279b.zip |
[ObjectYAML] Pull DWARF support into DWARFYAML namespace
Since DWARF formatting is agnostic to the object file it is stored in, it doesn't make sense for this to be in the MachOYAML implementation. Pulling it into its own namespace means we could modify the ELF and COFF YAML tools to emit DWARF as well.
In a follow-up patch I will better abstract this in obj2yaml and yaml2obj so that the DWARF bits in the tools can be re-used too.
llvm-svn: 288984
Diffstat (limited to 'llvm/lib/ObjectYAML')
-rw-r--r-- | llvm/lib/ObjectYAML/CMakeLists.txt | 1 | ||||
-rw-r--r-- | llvm/lib/ObjectYAML/DWARFYAML.cpp | 47 | ||||
-rw-r--r-- | llvm/lib/ObjectYAML/MachOYAML.cpp | 24 |
3 files changed, 48 insertions, 24 deletions
diff --git a/llvm/lib/ObjectYAML/CMakeLists.txt b/llvm/lib/ObjectYAML/CMakeLists.txt index 77370908046..2eee95b318d 100644 --- a/llvm/lib/ObjectYAML/CMakeLists.txt +++ b/llvm/lib/ObjectYAML/CMakeLists.txt @@ -4,4 +4,5 @@ add_llvm_library(LLVMObjectYAML ELFYAML.cpp MachOYAML.cpp ObjectYAML.cpp + DWARFYAML.cpp ) diff --git a/llvm/lib/ObjectYAML/DWARFYAML.cpp b/llvm/lib/ObjectYAML/DWARFYAML.cpp new file mode 100644 index 00000000000..a5f0255e338 --- /dev/null +++ b/llvm/lib/ObjectYAML/DWARFYAML.cpp @@ -0,0 +1,47 @@ +//===- DWARFYAML.cpp - DWARF YAMLIO implementation ------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines classes for handling the YAML representation of DWARF Debug +// Info. +// +//===----------------------------------------------------------------------===// + +#include "llvm/ObjectYAML/DWARFYAML.h" + +namespace llvm { + +bool DWARFYAML::DWARFData::isEmpty() const { + return 0 == DebugStrings.size() + AbbrevDecls.size(); +} + +namespace yaml { + +void MappingTraits<DWARFYAML::DWARFData>::mapping( + IO &IO, DWARFYAML::DWARFData &DWARF) { + IO.mapOptional("debug_str", DWARF.DebugStrings); + IO.mapOptional("debug_abbrev", DWARF.AbbrevDecls); +} + +void MappingTraits<DWARFYAML::DWARFAbbrev>::mapping( + IO &IO, DWARFYAML::DWARFAbbrev &Abbrev) { + IO.mapRequired("Code", Abbrev.Code); + IO.mapRequired("Tag", Abbrev.Tag); + IO.mapRequired("Children", Abbrev.Children); + IO.mapRequired("Attributes", Abbrev.Attributes); +} + +void MappingTraits<DWARFYAML::DWARFAttributeAbbrev>::mapping( + IO &IO, DWARFYAML::DWARFAttributeAbbrev &AttAbbrev) { + IO.mapRequired("Attribute", AttAbbrev.Attribute); + IO.mapRequired("Form", AttAbbrev.Form); +} + +} // namespace llvm::yaml + +} // namespace llvm diff --git a/llvm/lib/ObjectYAML/MachOYAML.cpp b/llvm/lib/ObjectYAML/MachOYAML.cpp index 41bbf9d0571..7ebb1bed088 100644 --- a/llvm/lib/ObjectYAML/MachOYAML.cpp +++ b/llvm/lib/ObjectYAML/MachOYAML.cpp @@ -29,10 +29,6 @@ bool MachOYAML::LinkEditData::isEmpty() const { NameList.size() + StringTable.size(); } -bool MachOYAML::DWARFData::isEmpty() const { - return 0 == DebugStrings.size() + AbbrevDecls.size(); -} - namespace yaml { void ScalarTraits<char_16>::output(const char_16 &Val, void *, @@ -557,26 +553,6 @@ void MappingTraits<MachO::version_min_command>::mapping( IO.mapRequired("sdk", LoadCommand.sdk); } -void MappingTraits<MachOYAML::DWARFData>::mapping( - IO &IO, MachOYAML::DWARFData &DWARF) { - IO.mapOptional("debug_str", DWARF.DebugStrings); - IO.mapOptional("debug_abbrev", DWARF.AbbrevDecls); -} - -void MappingTraits<MachOYAML::DWARFAbbrev>::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<MachOYAML::DWARFAttributeAbbrev>::mapping( - IO &IO, MachOYAML::DWARFAttributeAbbrev &AttAbbrev) { - IO.mapRequired("Attribute", AttAbbrev.Attribute); - IO.mapRequired("Form", AttAbbrev.Form); -} - } // namespace llvm::yaml } // namespace llvm |