[PATCH] D28386: Add the ability to iterate across all attributes in a DIE.

Greg Clayton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 5 16:29:13 PST 2017


clayborg created this revision.
clayborg added reviewers: dblaikie, aprantl, probinson, llvm-commits.
Herald added a subscriber: jgosnell.

In order for LLDB to be able to use the LLVM DWARF parser, it needs to be able to iterate across all attributes in a DWARFDie. This change adds a DWARFDie::attributes() function that allows easy iteration:

  for (auto &AttrValue : CUDie.attributes()) {
    switch (AttrValue.Attr) {
    case DW_AT_name:
      if (auto Name = AttrValue.Value.getAsCString())
        ...
      break;
    case DW_AT_declaration:
      if (auto Declaration = AttrValue.Value.getAsUnsignedConstant())
        ...
      break;
    case DW_AT_low_pc:
      if (auto LowPC = AttrValue.Value.getAsAddress())
        ...
      break;
    default:
      break;
    }
  }


https://reviews.llvm.org/D28386

Files:
  include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h
  include/llvm/DebugInfo/DWARF/DWARFAttribute.h
  include/llvm/DebugInfo/DWARF/DWARFDie.h
  lib/DebugInfo/DWARF/DWARFDie.cpp
  unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28386.83322.patch
Type: text/x-patch
Size: 10399 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170106/ce6f5a23/attachment.bin>


More information about the llvm-commits mailing list