[Lldb-commits] [lldb] [lldb] Add value to enumerator dump (PR #69815)
via lldb-commits
lldb-commits at lists.llvm.org
Fri Oct 20 23:41:34 PDT 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {darker}-->
:warning: Python code formatter, darker found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
darker --check --diff -r 4aae5387a874a55ee491f5dc23ce0506c5cdc678..886c627b8675886cfa09745c2441e3ab4aaadaea lldb/test/API/commands/expression/cast_int_to_anonymous_enum/TestCastIntToAnonymousEnum.py lldb/test/API/lang/c/enum_types/TestEnumTypes.py lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py lldb/test/API/lang/cpp/enum_types/TestCPP11EnumTypes.py lldb/test/API/lang/rust/enum-structs/TestRustEnumStructs.py
``````````
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- lang/c/enum_types/TestEnumTypes.py 2023-10-21 06:18:24.000000 +0000
+++ lang/c/enum_types/TestEnumTypes.py 2023-10-21 06:41:25.794197 +0000
@@ -20,16 +20,26 @@
lldbutil.run_to_source_breakpoint(
self, "// Breakpoint for bitfield", lldb.SBFileSpec("main.c")
)
- self.expect("fr var a", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = A\\(1\\)$"])
- self.expect("fr var b", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = B\\(2\\)$"])
- self.expect("fr var c", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = C\\(4\\)$"])
- self.expect("fr var ab", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = AB\\(3\\)$"])
+ self.expect(
+ "fr var a", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = A\\(1\\)$"]
+ )
+ self.expect(
+ "fr var b", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = B\\(2\\)$"]
+ )
+ self.expect(
+ "fr var c", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = C\\(4\\)$"]
+ )
+ self.expect(
+ "fr var ab", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = AB\\(3\\)$"]
+ )
self.expect("fr var ac", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = A | C$"])
- self.expect("fr var all", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = ALL\\(7\\)$"])
+ self.expect(
+ "fr var all", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = ALL\\(7\\)$"]
+ )
# Test that an enum that doesn't match the heuristic we use in
# TypeSystemClang::DumpEnumValue, gets printed as a raw integer.
self.expect("fr var omega", DATA_TYPES_DISPLAYED_CORRECTLY, patterns=[" = 7$"])
# Test the behavior in case have a variable of a type considered
# 'bitfield' by the heuristic, but the value isn't actually fully
--- lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py 2023-10-21 06:18:24.000000 +0000
+++ lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py 2023-10-21 06:41:25.867216 +0000
@@ -73,12 +73,16 @@
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(2)")
- self.expect_expr("A::scoped_ll_enum_val_neg", result_value="case0(-9223372036854775808)")
- self.expect_expr("A::scoped_ll_enum_val", result_value="case2(9223372036854775807)")
+ self.expect_expr(
+ "A::scoped_ll_enum_val_neg", result_value="case0(-9223372036854775808)"
+ )
+ self.expect_expr(
+ "A::scoped_ll_enum_val", result_value="case2(9223372036854775807)"
+ )
# Test taking address.
if lldbplatformutil.getPlatform() == "windows":
# On Windows data members without the out-of-class definitions still have
# valid adresses and the following expression works fine.
--- lang/cpp/enum_types/TestCPP11EnumTypes.py 2023-10-21 06:18:24.000000 +0000
+++ lang/cpp/enum_types/TestCPP11EnumTypes.py 2023-10-21 06:41:25.913160 +0000
@@ -21,13 +21,22 @@
"image lookup -t " + enum_name,
patterns=["enum( struct| class) " + enum_name + " {"],
substrs=["Case1", "Case2", "Case3"],
)
# Test each case in the enum.
- self.expect("expr var1_" + suffix, patterns=[f"\\({enum_name}\\) \\$\\d+ = Case1\\(-?\\d+\\)"])
- self.expect("expr var2_" + suffix, patterns=[f"\\({enum_name}\\) \\$\\d+ = Case2\\(-?\\d+\\)"])
- self.expect("expr var3_" + suffix, patterns=[f"\\({enum_name}\\) \\$\\d+ = Case3\\(-?\\d+\\)"])
+ self.expect(
+ "expr var1_" + suffix,
+ patterns=[f"\\({enum_name}\\) \\$\\d+ = Case1\\(-?\\d+\\)"],
+ )
+ self.expect(
+ "expr var2_" + suffix,
+ patterns=[f"\\({enum_name}\\) \\$\\d+ = Case2\\(-?\\d+\\)"],
+ )
+ self.expect(
+ "expr var3_" + suffix,
+ patterns=[f"\\({enum_name}\\) \\$\\d+ = Case3\\(-?\\d+\\)"],
+ )
if unsigned:
self.expect_expr(
"var_below_" + suffix, result_type=enum_name, result_value="199"
)
--- lang/rust/enum-structs/TestRustEnumStructs.py 2023-10-21 06:18:24.000000 +0000
+++ lang/rust/enum-structs/TestRustEnumStructs.py 2023-10-21 06:41:26.065694 +0000
@@ -30,11 +30,19 @@
self.target().FindFirstGlobalVariable("CLIKE_U8_C").GetValue(),
self.target().FindFirstGlobalVariable("CLIKE_U32_A").GetValue(),
self.target().FindFirstGlobalVariable("CLIKE_U32_B").GetValue(),
]
self.assertEqual(
- all_values, ["A(2)", "B(10)", "VariantA(0)", "VariantC(2)", "VariantA(1)", "VariantB(2)"]
+ all_values,
+ [
+ "A(2)",
+ "B(10)",
+ "VariantA(0)",
+ "VariantC(2)",
+ "VariantA(1)",
+ "VariantB(2)",
+ ],
)
def test_enum_with_tuples_has_all_variants(self):
self.assertEqual(
self.getFromGlobal("ENUM_WITH_TUPLES_A").getAllVariantTypes(),
``````````
</details>
https://github.com/llvm/llvm-project/pull/69815
More information about the lldb-commits
mailing list