[Lldb-commits] [lldb] Summarize std::string's when created from data. (PR #89110)

via lldb-commits lldb-commits at lists.llvm.org
Tue May 21 10:58:13 PDT 2024


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 3074060d6a1d7d2e74cb767876bd9e5192d12007...29b55fcba7a7f7b7ab0581f7804b9ad70863b0ff lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/ConvertToDataFormatter.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/TestDataFormatterStdString.py
``````````

</details>

<details>
<summary>
View the diff from darker here.
</summary>

``````````diff
--- ConvertToDataFormatter.py	2024-04-16 22:18:59.000000 +0000
+++ ConvertToDataFormatter.py	2024-05-21 17:57:50.207877 +0000
@@ -2,10 +2,11 @@
 """
 Helper formmater to verify Std::String by created via SBData
 """
 
 import lldb
+
 
 class SyntheticFormatter:
     def __init__(self, valobj, dict):
         self.valobj = valobj
 
@@ -33,13 +34,11 @@
             case _:
                 return None
 
         child = self.valobj.GetChildMemberWithName(name)
         valType = child.GetType()
-        return self.valobj.CreateValueFromData(name,
-                child.GetData(),
-                valType)
+        return self.valobj.CreateValueFromData(name, child.GetData(), valType)
 
 
 def __lldb_init_module(debugger, dict):
     typeName = "string_container"
     debugger.HandleCommand(
--- TestDataFormatterStdString.py	2024-04-24 20:52:10.000000 +0000
+++ TestDataFormatterStdString.py	2024-05-21 17:57:50.260723 +0000
@@ -92,11 +92,10 @@
 
         self.runCmd("next")
 
         self.assertEqual(var_S.GetSummary(), 'L"!!!!!"', "new S summary wrong")
 
-
     @add_test_categories(["libstdcxx"])
     @expectedFailureAll(bugnumber="llvm.org/pr50861", compiler="gcc")
     def test_std_string_as_data(self):
         """Test that strings created via SBValue::CreateFromData display correctly."""
         self.build()
@@ -122,26 +121,32 @@
         var_str_container = self.frame().FindVariable("sc")
 
         self.assertEqual(
             var_str_container.GetChildAtIndex(0).GetSummary(),
             '"u22"',
-            "string container child wrong")
+            "string container child wrong",
+        )
         self.assertEqual(
             var_str_container.GetChildAtIndex(1).GetSummary(),
             '"quite a long std::string with lots of info inside it inside a struct"',
-            "string container child wrong")
+            "string container child wrong",
+        )
         self.assertEqual(
             var_str_container.GetChildAtIndex(2).GetSummary(),
             '"u22"',
-            "string container child wrong")
+            "string container child wrong",
+        )
         self.assertEqual(
             var_str_container.GetChildAtIndex(3).GetSummary(),
             '"quite a long std::string with lots of info inside it inside a struct"',
-            "string container child wrong")
+            "string container child wrong",
+        )
         self.assertEqual(
             var_str_container.GetChildAtIndex(4).GetSummary(),
             '"u22"',
-            "string container child wrong")
+            "string container child wrong",
+        )
         self.assertEqual(
             var_str_container.GetChildAtIndex(5).GetSummary(),
             '"quite a long std::string with lots of info inside it inside a struct"',
-            "string container child wrong")
+            "string container child wrong",
+        )

``````````

</details>


https://github.com/llvm/llvm-project/pull/89110


More information about the lldb-commits mailing list