This is an archive of the discontinued LLVM Phabricator instance.

[LLDB] Add multi value test for const static enum
ClosedPublic

Authored by DavidSpickett on Aug 9 2022, 1:43 AM.

Details

Summary

1438639a2f7eb9e9cba01454d3a9b1b16d179c9a removed a test
that was using undefined behaviour setting a non-typed enum
to a value outside its known range.

That test also checked if we formatted the value properly
when it could contain >1 valid enum value.

I don't think there's anything special about how we format
typed vs non-typed enums so I'm adding a test for ScopedEnum
that will expect to see 2 enum values plus extra.

Diff Detail

Event Timeline

DavidSpickett created this revision.Aug 9 2022, 1:43 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 9 2022, 1:43 AM
DavidSpickett requested review of this revision.Aug 9 2022, 1:43 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 9 2022, 1:43 AM

clang-format

Michael137 accepted this revision.Aug 9 2022, 2:02 AM
This revision is now accepted and ready to land.Aug 9 2022, 2:02 AM
labath accepted this revision.Aug 9 2022, 6:36 AM
labath added a reviewer: shafik.

Good catch. Lldb should try to be useful even if the debugged program invokes undefined behavior.

shafik added a comment.Aug 9 2022, 4:09 PM

Good catch. Lldb should try to be useful even if the debugged program invokes undefined behavior.

Totally agree, for the purposes here there should be no difference for these purposes between a scoped enum and an enum without a fixed underlying type.

lldb/test/API/lang/cpp/const_static_integral_member/main.cpp
52

I am just going to super nitpick here and say that these are not invalid values. When we have a fixed underlying type we are allowed to use the full range of the underlying type. The values may be outside the range of the enumerators but they are valid values.

shafik accepted this revision.Aug 9 2022, 4:10 PM

LGTM. Thank you for the quick follow-up.

invalid -> not_enumerator

DavidSpickett marked an inline comment as done.Aug 10 2022, 1:49 AM
This revision was landed with ongoing or failed builds.Aug 10 2022, 1:50 AM
This revision was automatically updated to reflect the committed changes.