[PATCH] D27634: Make a DWARFDIE class that can help avoid using the wrong DWARFUnit when extracting attributes

Greg Clayton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 9 14:51:12 PST 2016


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

Many places pass around a DWARFDebugInfoEntryMinimal and a DWARFUnit. It is easy to get things wrong by using the wrong DWARFUnit with a  DWARFDebugInfoEntryMinimal. This patch creates a DWARFDie class that contains the DWARFUnit and  DWARFDebugInfoEntryMinimal objects so that they can't get out of sync. All attribute extraction has been moved out of  DWARFDebugInfoEntryMinimal and into DWARFDie.  DWARFDebugInfoEntryMinimal was also renamed to  DWARFDebugInfoEntry.

DWARFDie objects are temporary objects that are used by clients and contain 2 pointers that you always need to have anyway. Keeping them grouped will avoid errors and simplify many of the attribute extracting APIs by not having to pass in a DWARFUnit.


https://reviews.llvm.org/D27634

Files:
  include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h
  include/llvm/DebugInfo/DWARF/DWARFDie.h
  include/llvm/DebugInfo/DWARF/DWARFUnit.h
  lib/DebugInfo/DWARF/CMakeLists.txt
  lib/DebugInfo/DWARF/DWARFCompileUnit.cpp
  lib/DebugInfo/DWARF/DWARFContext.cpp
  lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp
  lib/DebugInfo/DWARF/DWARFDie.cpp
  lib/DebugInfo/DWARF/DWARFTypeUnit.cpp
  lib/DebugInfo/DWARF/DWARFUnit.cpp
  tools/dsymutil/DwarfLinker.cpp
  unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
  unittests/DebugInfo/DWARF/DwarfGenerator.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27634.80959.patch
Type: text/x-patch
Size: 124784 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161209/f9fd3b68/attachment.bin>


More information about the llvm-commits mailing list