[Lldb-commits] [PATCH] D67520: Add pretty printing of Clang "bitfield" enums

Frederic Riss via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Sep 12 13:59:49 PDT 2019


friss created this revision.
friss added reviewers: jingham, labath.

Using enumerators as flags is standard practice. This patch adds
support to LLDB to display such enum values symbolically, eg:

(E) e1 = A | B

If enumerators don't cover the whole value, the remaining bits are
displayed as hexadecimal:

(E) e4 = A | 0x10

Detecting whether an enum is used as a bitfield or not is
complicated. This patch implements a heuristic that assumes that such
enumerators will either have only 1 bit set or will be a combination
of previous values.

This patch doesn't change the way we currently display enums which the
above heuristic would not consider as bitfields.


https://reviews.llvm.org/D67520

Files:
  lit/SymbolFile/DWARF/debug-types-missing-signature.test
  packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py
  packages/Python/lldbsuite/test/lang/c/enum_types/main.c
  source/Symbol/ClangASTContext.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67520.219993.patch
Type: text/x-patch
Size: 8524 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190912/53a0f13b/attachment.bin>


More information about the lldb-commits mailing list