[PATCH] D44570: [dwarf] Unify unknown dwarf enum formatting code
Pavel Labath via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 16 08:27:05 PDT 2018
labath created this revision.
labath added reviewers: dblaikie, JDevlieghere, aprantl.
We have at least three pieces of code (in DWARFAbbreviationDeclaration,
DWARFAcceleratorTable and DWARFDie) that have hand-rolled support for
dumping unknown dwarf enum values. While not terrible, they are a bit
distracting and enable small differences to creep in (Unknown_ffff vs.
Unknown_0xffff). I ended up needing to add a fourth place
(DWARFVerifier), so I though it would be a good time to centralize.
This patch creates an alternative to the XXXString dumping functions in
the BinaryFormat library, which formats an unknown value as
DW_TYPE_Unknown_1234, instead of just an empty string. It is based on
the formatv function, as that allows us to avoid materializing the
string for unknown values (and because this way I don't have to invent a
name for the new functions :P).
Right now, I just demonstrate the principle with DW_TAG constants, but
other enums could be handled the same way as well.
Repository:
rL LLVM
https://reviews.llvm.org/D44570
Files:
include/llvm/BinaryFormat/Dwarf.h
lib/BinaryFormat/Dwarf.cpp
lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
lib/DebugInfo/DWARF/DWARFDie.cpp
unittests/BinaryFormat/DwarfTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44570.138715.patch
Type: text/x-patch
Size: 6393 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180316/b3954ce1/attachment.bin>
More information about the llvm-commits
mailing list