Debugger: Adjust libcpp based optional dumper

There is no added value in providing the value of the
internal 'engaged' - just provide the value if possible.

Change-Id: I8c308902bf82c43e4238568fc9b185c3a3994b47
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2023-11-02 13:15:24 +01:00
parent 10a390c3d2
commit cf88267011
3 changed files with 5 additions and 8 deletions

View File

@@ -508,12 +508,9 @@ def qdump__std____1__variant(d, value):
def qdump__std____1__optional(d, value):
if value['__engaged_'].integer() == 0:
d.putSpecialValue("uninitialized")
d.putNumChild(2)
if d.isExpanded():
with Children(d):
d.putSubItem("engaged", value['__engaged_'])
d.putSubItem("value", value['#1']['__val_'])
d.putSpecialValue("empty")
else:
d.putItem(value['#1']['__val_'])
def qdump__std____1__tuple(d, value):

View File

@@ -1108,7 +1108,7 @@ def qdump__std__optional(d, value):
d.putItem(payload)
d.putBetterType(innerType)
else:
d.putSpecialValue("uninitialized")
d.putSpecialValue("empty")
def qdump__std__experimental__optional(d, value):

View File

@@ -5627,7 +5627,7 @@ void tst_Dumpers::dumper_data()
+ Cxx17Profile()
+ Check("o1", "<uninitialized>", "std::optional<bool>")
+ Check("o1", "<empty>", "std::optional<bool>")
+ Check("o2", "1", "bool") // 1 -> true is done on display
+ Check("o3", "<3 items>", "std::vector<int>")
+ Check("o3.1", "[1]", "2", "int");