[Lldb-commits] [PATCH] D131472: [LLDB] Add multi value test for const static enum
David Spickett via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Aug 9 01:43:18 PDT 2022
DavidSpickett created this revision.
Herald added a project: All.
DavidSpickett requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
1438639a2f7eb9e9cba01454d3a9b1b16d179c9a <https://reviews.llvm.org/rG1438639a2f7eb9e9cba01454d3a9b1b16d179c9a> 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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D131472
Files:
lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
lldb/test/API/lang/cpp/const_static_integral_member/main.cpp
Index: lldb/test/API/lang/cpp/const_static_integral_member/main.cpp
===================================================================
--- lldb/test/API/lang/cpp/const_static_integral_member/main.cpp
+++ lldb/test/API/lang/cpp/const_static_integral_member/main.cpp
@@ -49,6 +49,7 @@
const static Enum enum_val = enum_case2;
const static ScopedEnum scoped_enum_val = ScopedEnum::scoped_enum_case2;
const static ScopedEnum invalid_scoped_enum_val = static_cast<ScopedEnum>(5);
+ const static ScopedEnum invalid_scoped_enum_val_2 = static_cast<ScopedEnum>(7);
const static ScopedCharEnum scoped_char_enum_val = ScopedCharEnum::case2;
const static ScopedLongLongEnum scoped_ll_enum_val_neg =
ScopedLongLongEnum::case0;
Index: lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
===================================================================
--- lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
+++ lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
@@ -58,6 +58,9 @@
self.expect_expr("A::scoped_enum_val", result_value="scoped_enum_case2")
# Test an scoped enum with an invalid enum case.
self.expect_expr("A::invalid_scoped_enum_val", result_value="scoped_enum_case1 | 0x4")
+ # This time with more than one enum value plus the extra.
+ self.expect_expr("A::invalid_scoped_enum_val_2",
+ result_value="scoped_enum_case1 | scoped_enum_case2 | 0x4")
# Test an enum with fixed underlying type.
self.expect_expr("A::scoped_char_enum_val", result_value="case2")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131472.451066.patch
Type: text/x-patch
Size: 1671 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220809/209821f1/attachment.bin>
More information about the lldb-commits
mailing list