mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
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:
parent
3d0786f96b
commit
b808815e57
Notes:
sideshowbarker
2024-07-18 17:34:23 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/b808815e57f Pull-request: https://github.com/SerenityOS/serenity/pull/7379 Reviewed-by: https://github.com/bgianfo ✅ Reviewed-by: https://github.com/gunnarbeutner ✅
1 changed files with 7 additions and 0 deletions
|
@ -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)}>'
|
||||
|
||||
|
|
Loading…
Reference in a new issue