1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00
llvm-mirror/tools/obj2yaml
Greg Clayton 41824e5554 Cleanup how DWARFDie attributes are accessed and decoded.
Removed all DWARFDie::getAttributeValueAs*() calls.
Renamed:
  Optional<DWARFFormValue> DWARFDie::getAttributeValue(dwarf::Attribute);
To:
  Optional<DWARFFormValue> DWARFDie::find(dwarf::Attribute);
Added:
  Optional<DWARFFormValue> DWARFDie::findRecursively(dwarf::Attribute);
  
All decoding of Optional<DWARFFormValue> values are now done using the dwarf::to*() functions from DWARFFormValue.h:

Old code:
  
  auto DeclLine = DWARFDie.getAttributeValueAsSignedConstant(DW_AT_decl_line).getValueOr(0);
  
New code:

  auto DeclLine = toUnsigned(DWARFDie.find(DW_AT_decl_line), 0);
  
This composition helps us since we can now easily do:

  auto DeclLine = toUnsigned(DWARFDie.findRecursively(DW_AT_decl_line), 0);
  
This allows us to easily find attribute values in the current DIE only (the first new code above) or in any DW_AT_abstract_origin or DW_AT_specification Dies using the line above. Note that the code line length is shorter and more concise.

Differential Revision: https://reviews.llvm.org/D28581

llvm-svn: 291959
2017-01-13 21:08:18 +00:00
..
CMakeLists.txt [obj2yaml] Refactor and abstract dwarf2yaml 2016-12-07 21:47:28 +00:00
coff2yaml.cpp Thread Expected<...> up from libObject’s getName() for symbols to allow llvm-objdump to produce a good error message. 2016-04-20 21:24:34 +00:00
dwarf2yaml.cpp Cleanup how DWARFDie attributes are accessed and decoded. 2017-01-13 21:08:18 +00:00
elf2yaml.cpp [ELF] Convert ELF.h to Expected<T>. 2016-11-16 05:10:28 +00:00
Error.cpp Remove LLVM_NOEXCEPT and replace it with noexcept 2016-10-19 23:52:38 +00:00
Error.h Remove some 'const' specifiers that do nothing but prevent moving the argument. 2016-05-29 10:46:35 +00:00
macho2yaml.cpp [ObjectYAML] MachO support for endianness 2016-12-22 21:58:03 +00:00
obj2yaml.cpp [obj2yaml] [yaml2obj] Support for MachO Universal binaries 2016-06-24 20:42:28 +00:00
obj2yaml.h [ObjectYAML] Remove DWARF from class names 2016-12-08 17:46:57 +00:00