From d06183d9cc6777b64bcd434ee737ea978339eed7 Mon Sep 17 00:00:00 2001 From: Anton Alimoff Date: Tue, 16 Nov 2021 17:48:30 +0300 Subject: [PATCH] Add debug helper for std::variant Change-Id: Ifb2f47203fb5c101be5b2180693e39ba07b90c2e Reviewed-by: hjk --- share/qtcreator/debugger/stdtypes.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/share/qtcreator/debugger/stdtypes.py b/share/qtcreator/debugger/stdtypes.py index 61ff7727fe5..0bc5c1e5ffe 100644 --- a/share/qtcreator/debugger/stdtypes.py +++ b/share/qtcreator/debugger/stdtypes.py @@ -1068,6 +1068,16 @@ def qdump__std____1__valarray(d, value): d.putItemCount(size) d.putPlotData(begin, size, innerType) +def qdump__std__variant(d, value): + which = int(value["_M_index"]) + type = d.templateArgument(value.type, which) + d.putValue("<%s:%s>" % (which, type.name)) + + d.putNumChild(1) + if d.isExpanded(): + storage = value["_M_u"]["_M_first"]["_M_storage"] + with Children(d, 1): + d.putSubItem("value", storage.cast(type)) def qform__std__vector(): return [DisplayFormat.ArrayPlot]