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

Frederic Riss via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 16 08:26:40 PDT 2019


friss added a comment.

In D67520#1670880 <https://reviews.llvm.org/D67520#1670880>, @labath wrote:

> This looks like a really useful feature. The code seems fine, but I am wondering if we should really bail out when encountering a zero enumerator. It is not uncommon to use a special enumerator to mean "none of the above". Lldb does that occasionally (eEmulateInstructionOptionNone), and other APIs do that too (PROT_NONE, PROT_READ, PROT_WRITE, PROT_EXEC in mmap(2) for instance). I am guessing this practice is even more common for "class" enums, as those can't be implicitly constructed from integer constants.
>
> I think it would be useful to add one or two tests with enum types where this heuristic does not kick in. Like a type which has a two-bit enumerator which is not covered by previous enumerators, or (if you decide to keep the current behavior) a type with a zero enumerator.


I had looked at a few enums in LLVM before sending out the patch and decided to remove the "0" heuristic. I wrote the patch description with the new heuristic and then forgot to update the patch itself... I'm currently tracking down another regression that prevents Jim's use case from working, I'll refresh the patch with your comments addressed after I'm done with this.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67520/new/

https://reviews.llvm.org/D67520





More information about the lldb-commits mailing list