[Lldb-commits] [PATCH] D131472: [LLDB] Add multi value test for const static enum

2022-08-10 Thread David Spickett via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5e538c669c76: [LLDB] Add multi value test for const static 
enum (authored by DavidSpickett).

Repository:
  rG LLVM Github Monorepo

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

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
@@ -48,7 +48,9 @@
 
   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(5);
+  const static ScopedEnum not_enumerator_scoped_enum_val = 
static_cast(5);
+  const static ScopedEnum not_enumerator_scoped_enum_val_2 =
+  static_cast(7);
   const static ScopedCharEnum scoped_char_enum_val = ScopedCharEnum::case2;
   const static ScopedLongLongEnum scoped_ll_enum_val_neg =
   ScopedLongLongEnum::case0;
@@ -102,7 +104,7 @@
 
   Enum e = A::enum_val;
   ScopedEnum se = A::scoped_enum_val;
-  se = A::invalid_scoped_enum_val;
+  se = A::not_enumerator_scoped_enum_val;
   ScopedCharEnum sce = A::scoped_char_enum_val;
   ScopedLongLongEnum sle = A::scoped_ll_enum_val;
 
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
@@ -56,8 +56,11 @@
 
 # Test a scoped enum.
 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")
+# Test an scoped enum with a value that isn't an enumerator.
+self.expect_expr("A::not_enumerator_scoped_enum_val", 
result_value="scoped_enum_case1 | 0x4")
+# This time with more than one enum value plus the extra.
+self.expect_expr("A::not_enumerator_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")


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
@@ -48,7 +48,9 @@
 
   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(5);
+  const static ScopedEnum not_enumerator_scoped_enum_val = static_cast(5);
+  const static ScopedEnum not_enumerator_scoped_enum_val_2 =
+  static_cast(7);
   const static ScopedCharEnum scoped_char_enum_val = ScopedCharEnum::case2;
   const static ScopedLongLongEnum scoped_ll_enum_val_neg =
   ScopedLongLongEnum::case0;
@@ -102,7 +104,7 @@
 
   Enum e = A::enum_val;
   ScopedEnum se = A::scoped_enum_val;
-  se = A::invalid_scoped_enum_val;
+  se = A::not_enumerator_scoped_enum_val;
   ScopedCharEnum sce = A::scoped_char_enum_val;
   ScopedLongLongEnum sle = A::scoped_ll_enum_val;
 
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
@@ -56,8 +56,11 @@
 
 # Test a scoped enum.
 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")
+# Test an scoped enum with a value that isn't an enumerator.
+self.expect_expr("A::not_enumerator_scoped_enum_val", result_value="scoped_enum_case1 | 0x4")
+# This time with more than one enum value plus the extra.
+self.expect_expr("A::not_enumerator_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")

[Lldb-commits] [PATCH] D131472: [LLDB] Add multi value test for const static enum

2022-08-10 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett updated this revision to Diff 451386.
DavidSpickett added a comment.

invalid -> not_enumerator


Repository:
  rG LLVM Github Monorepo

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

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
@@ -48,7 +48,9 @@
 
   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(5);
+  const static ScopedEnum not_enumerator_scoped_enum_val = 
static_cast(5);
+  const static ScopedEnum not_enumerator_scoped_enum_val_2 =
+  static_cast(7);
   const static ScopedCharEnum scoped_char_enum_val = ScopedCharEnum::case2;
   const static ScopedLongLongEnum scoped_ll_enum_val_neg =
   ScopedLongLongEnum::case0;
@@ -102,7 +104,7 @@
 
   Enum e = A::enum_val;
   ScopedEnum se = A::scoped_enum_val;
-  se = A::invalid_scoped_enum_val;
+  se = A::not_enumerator_scoped_enum_val;
   ScopedCharEnum sce = A::scoped_char_enum_val;
   ScopedLongLongEnum sle = A::scoped_ll_enum_val;
 
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
@@ -56,8 +56,11 @@
 
 # Test a scoped enum.
 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")
+# Test an scoped enum with a value that isn't an enumerator.
+self.expect_expr("A::not_enumerator_scoped_enum_val", 
result_value="scoped_enum_case1 | 0x4")
+# This time with more than one enum value plus the extra.
+self.expect_expr("A::not_enumerator_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")


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
@@ -48,7 +48,9 @@
 
   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(5);
+  const static ScopedEnum not_enumerator_scoped_enum_val = static_cast(5);
+  const static ScopedEnum not_enumerator_scoped_enum_val_2 =
+  static_cast(7);
   const static ScopedCharEnum scoped_char_enum_val = ScopedCharEnum::case2;
   const static ScopedLongLongEnum scoped_ll_enum_val_neg =
   ScopedLongLongEnum::case0;
@@ -102,7 +104,7 @@
 
   Enum e = A::enum_val;
   ScopedEnum se = A::scoped_enum_val;
-  se = A::invalid_scoped_enum_val;
+  se = A::not_enumerator_scoped_enum_val;
   ScopedCharEnum sce = A::scoped_char_enum_val;
   ScopedLongLongEnum sle = A::scoped_ll_enum_val;
 
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
@@ -56,8 +56,11 @@
 
 # Test a scoped enum.
 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")
+# Test an scoped enum with a value that isn't an enumerator.
+self.expect_expr("A::not_enumerator_scoped_enum_val", result_value="scoped_enum_case1 | 0x4")
+# This time with more than one enum value plus the extra.
+self.expect_expr("A::not_enumerator_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")
___
lldb-commits mailing list
lldb-commits@lists.llvm.org

[Lldb-commits] [PATCH] D131472: [LLDB] Add multi value test for const static enum

2022-08-09 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik accepted this revision.
shafik added a comment.

LGTM. Thank you for the quick follow-up.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131472

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D131472: [LLDB] Add multi value test for const static enum

2022-08-09 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added a comment.

In D131472#3709684 , @labath wrote:

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




Comment at: lldb/test/API/lang/cpp/const_static_integral_member/main.cpp:52
   const static ScopedEnum invalid_scoped_enum_val = static_cast(5);
+  const static ScopedEnum invalid_scoped_enum_val_2 =
+  static_cast(7);

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. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131472

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D131472: [LLDB] Add multi value test for const static enum

2022-08-09 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a reviewer: shafik.
labath added a comment.

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


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131472

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D131472: [LLDB] Add multi value test for const static enum

2022-08-09 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett updated this revision to Diff 451067.
DavidSpickett added a comment.
Herald added a subscriber: JDevlieghere.

clang-format


Repository:
  rG LLVM Github Monorepo

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

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,8 @@
   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(5);
+  const static ScopedEnum invalid_scoped_enum_val_2 =
+  static_cast(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")


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,8 @@
   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(5);
+  const static ScopedEnum invalid_scoped_enum_val_2 =
+  static_cast(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")
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D131472: [LLDB] Add multi value test for const static enum

2022-08-09 Thread David Spickett via Phabricator via lldb-commits
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 
 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(5);
+  const static ScopedEnum invalid_scoped_enum_val_2 = 
static_cast(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")


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(5);
+  const static ScopedEnum invalid_scoped_enum_val_2 = static_cast(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")
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits