================
@@ -606,3 +606,47 @@ def is_numeric_type(basic_type):
return (False,False)
%}
+
+%pythoncode %{
+
+def _type_spec(type_name, regex):
+ type_spec = f"'{type_name}'"
+ if regex:
+ type_spec = f"-x {type_spec}"
+ return type_spec
+
+def summary(type_name, regex=False):
+ """A decorator that registers a function as an LLDB type summary provider.
+
+ @lldb.summary("MyType")
+ def MyTypeSummary(valobj, internal_dict):
+ return "summary string"
+ """
+ type_spec = _type_spec(type_name, regex)
+ def decorator(func):
+ qualified = f"{func.__module__}.{func.__qualname__}"
+ func._lldb_register_command = f"type summary add -F {qualified}
{type_spec}"
+ return func
+ return decorator
----------------
JDevlieghere wrote:
Seems like this could be extracted in a helper that takes `qualified` and
`-F/-l`?
https://github.com/llvm/llvm-project/pull/195351
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits