Add the ability for DWARFDie objects to get the parent DWARFDie.
authorGreg Clayton <gclayton@apple.com>
Wed, 21 Dec 2016 21:37:06 +0000 (21:37 +0000)
committerGreg Clayton <gclayton@apple.com>
Wed, 21 Dec 2016 21:37:06 +0000 (21:37 +0000)
commit78a07bfa66e673ae766f8dfb7dd4f9bebba8fce6
tree6e307bcba084e2926c758986d8dd09b48d4a0f14
parente9ce09b89f6cb865ea651af3f33f2fd247b23544
Add the ability for DWARFDie objects to get the parent DWARFDie.

In order for the llvm DWARF parser to be used in LLDB we will need to be able to get the parent of a DIE. This patch adds that functionality by changing the DWARFDebugInfoEntry class to store a depth field instead of a sibling index. Using a depth field allows us to easily calculate the sibling and the parent without increasing the size of DWARFDebugInfoEntry.

I tested llvm-dsymutil on a debug version of clang where this fully parses DWARF in over 1200 .o files to verify there was no serious regression in performance.

Added a full suite of unit tests to test this functionality.

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

llvm-svn: 290274
llvm/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h
llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h
llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
llvm/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp
llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp