Make a DWARFDIE class that can help avoid using the wrong DWARFUnit when extracting...
authorGreg Clayton <gclayton@apple.com>
Tue, 13 Dec 2016 18:25:19 +0000 (18:25 +0000)
committerGreg Clayton <gclayton@apple.com>
Tue, 13 Dec 2016 18:25:19 +0000 (18:25 +0000)
commitc8c1032c0c52d7f851ccfa29ec850b24047ebcb9
tree83f7c48017baaef8f964eea18527f5f736aa7034
parentc21b3c949d370c36333ea7b401d780c500cef11a
Make a DWARFDIE class that can help avoid using the wrong DWARFUnit when extracting attributes

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.

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

llvm-svn: 289565
13 files changed:
llvm/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h
llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h [new file with mode: 0644]
llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
llvm/lib/DebugInfo/DWARF/CMakeLists.txt
llvm/lib/DebugInfo/DWARF/DWARFCompileUnit.cpp
llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
llvm/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp
llvm/lib/DebugInfo/DWARF/DWARFDie.cpp [new file with mode: 0644]
llvm/lib/DebugInfo/DWARF/DWARFTypeUnit.cpp
llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
llvm/tools/dsymutil/DwarfLinker.cpp
llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp