HomePhabricator

Add pretty printing of Clang "bitfield" enums

Authored by friss on Oct 8 2019, 8:35 AM.

Description

Add pretty printing of Clang "bitfield" enums

Summary:
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.

Reviewers: jingham, labath

Subscribers: lldb-commits

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

llvm-svn: 374067

Details

Committed
frissOct 8 2019, 8:35 AM
Differential Revision
D67520: Add pretty printing of Clang "bitfield" enums
Parents
rGd6470fb01a08: Extract and simplify DumpEnumValue
Branches
Unknown
Tags
Unknown