Meta: Display DistinctNumeric as its alias name in GDB if possible

All DistinctNumerics are given an identifying tag, if the tag is
generated by the macro, print the alias instead of DistinctNumeric.
This commit is contained in:
Ali Mohammad Pur 2021-05-22 12:12:51 +04:30 committed by Ali Mohammad Pur
parent 3d0786f96b
commit b808815e57
Notes: sideshowbarker 2024-07-18 17:34:23 +09:00

View file

@ -78,6 +78,13 @@ class AKDistinctNumeric:
@classmethod
def prettyprint_type(cls, type):
actual_name = type.template_argument(1)
parts = actual_name.name.split("::")
unqualified_name = re.sub(r'__(\w+)_tag', r'\1', actual_name.name)
if unqualified_name != actual_name.name:
qualified_name = '::'.join(parts[:-2] + [unqualified_name])
return qualified_name
# If the tag is malformed, just print DistinctNumeric<T>
contained_type = type.template_argument(0)
return f'AK::DistinctNumeric<{handler_class_for_type(contained_type).prettyprint_type(contained_type)}>'