[PATCH] D28581: Change DWARFDie::getAttributeValue() to DWARFDie::find(), add DWARFDie::findRecurse() and dwarf::toString() helper functions.

Greg Clayton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 11 15:03:54 PST 2017


clayborg created this revision.
clayborg added reviewers: dblaikie, probinson, aprantl, echristo, llvm-commits.
Herald added subscribers: jgosnell, mehdi_amini.

In an effort to get DWARFDie::getAttributeValueAsXXX() calls to be more concise we want to:

- shorten the function names
- reduce the number of methods
- provide robust ways to get attributes and extract value

This is a proposal where we rename:

  Optional<DWARFFormValue> DWARFDie::getAttributeValue(dwarf::Attribute Attr) const;

To:

  Optional<DWARFFormValue> DWARFDie::find(dwarf::Attribute Attr) const;

And add:

  Optional<DWARFFormValue> DWARFDie::findRecurse(dwarf::Attribute Attr) const;

So we can recurse into the DW_AT_abstract_origin and DW_AT_specification DIEs. Then by adding new helper functions, we can extract specific kinds of data from the returned Optional<DWARFFormValue> (see the dwarf::toString() functions in DWARFFormValue.h.

This is a test to see if people like how the code looks and like the interface before we possibly, if we like it, cut all code over to using it.


https://reviews.llvm.org/D28581

Files:
  include/llvm/DebugInfo/DWARF/DWARFDie.h
  include/llvm/DebugInfo/DWARF/DWARFFormValue.h
  lib/DebugInfo/DWARF/DWARFDie.cpp
  tools/obj2yaml/dwarf2yaml.cpp
  unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28581.84031.patch
Type: text/x-patch
Size: 11718 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170111/fa8786be/attachment.bin>


More information about the llvm-commits mailing list