This is an archive of the discontinued LLVM Phabricator instance.

NFC: Change PointerLikeTypeTraits::NumLowBitsAvailable from enum to static member. This allows GDB pretty printer to find the value.
AbandonedPublic

Authored by csigg on Jan 13 2020, 12:28 AM.

Details

Reviewers
aprantl
dblaikie
Summary

NFC: PointerLikeTypeTraits::NumLowBitsAvailable enum > static int

Diff Detail

Event Timeline

csigg created this revision.Jan 13 2020, 12:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 13 2020, 12:28 AM

Unit tests: pass. 61776 tests passed, 0 failed and 780 were skipped.

clang-tidy: pass.

clang-format: pass.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

Could you provide a small example of the problem here? LLVM does emit debug info for used enums (granted, if it's used as a template parameter it looks like LLVM does not emit them - but if it's used in a runtime evaluated expression it does/should & it looks like NumLowBitsAvailable is used in that way pretty regularly)

Does the debug info have the enum/enumerator/constant, but GDB provide no way to look it up?

csigg added a comment.Jan 14 2020, 2:40 PM

I was not able to get to NumLowBitsAvailable through Python GDB if it's an enumeration inside an anonymous struct.

  • If it's in a named struct, I could use gdb.lookup_type(enum_name).fields() and parse the Field.name and get the Field.enumvalue.
  • If it's a static member, I can do gdb.parse_and_evel(enumeration_name) or gdb.lookup_symbol(enumeration_name)[0].value().

I'm not sure anymore if I tried a named struct with the latter, but possibly it would work.
The current status is a mix of anonymous enums and 'static const', so maybe unifying it is the easiest way to make it work.

I've committed a generalization of this (applying the same logic to all instances of NumLowBitsAvailable) in 65eb74e94b414fcde6bfa810d1c30c7fcb136b77 - so this review can be closed or abandoned.

I've committed a generalization of this (applying the same logic to all instances of NumLowBitsAvailable) in 65eb74e94b414fcde6bfa810d1c30c7fcb136b77 - so this review can be closed or abandoned.

Ah, if I'm reading the other review correctly, this change was/is no longer needed - ah well, it's committed now & not harmful (a little questionable given the lack of storage... but I think it might as well stay that way in hopes of the C++17 future state of things).

csigg added a comment.Jan 20 2020, 9:56 AM

Thanks a lot for your help. Sorry I've not been keeping up.

csigg abandoned this revision.Jan 20 2020, 9:56 AM