Skip to content

Commit 77448be

Browse files
committed
feat(visitor): add handling for attributes
1 parent 16f9c45 commit 77448be

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/dwarf2cpp/visitor.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,8 @@ def visit_typedef(self, die: DWARFDie) -> None:
286286
match attribute.name:
287287
case "DW_AT_alignment":
288288
typedef.alignment = attribute.value.as_constant()
289+
case "DW_AT_accessibility":
290+
typedef.access = AccessAttribute(attribute.value.as_constant())
289291
case _:
290292
print(die.dump())
291293
raise ValueError(f"Unhandled attribute {attribute.name}")
@@ -668,14 +670,16 @@ def visit_GNU_template_parameter_pack(self, die: DWARFDie) -> None:
668670

669671
def visit_GNU_template_template_param(self, die: DWARFDie) -> None:
670672
param = TemplateParameter(TemplateParameterKind.TEMPLATE, name=die.short_name)
673+
if value := die.find("DW_AT_GNU_template_name"):
674+
param.type = value.as_string()
671675

672676
for attribute in die.attributes:
673-
if attribute.name in {"DW_AT_name"}:
677+
if attribute.name in {"DW_AT_name", "DW_AT_GNU_template_name"}:
674678
continue
675679

676680
match attribute.name:
677-
case "DW_AT_GNU_template_name":
678-
param.type = attribute.value.as_string()
681+
case "DW_AT_default_value":
682+
param.default = param.type
679683
case _:
680684
raise ValueError(f"Unhandled attribute {attribute.name}")
681685

@@ -752,6 +756,7 @@ def _handle_attribute(self, die: DWARFDie) -> None:
752756
"DW_AT_location",
753757
"DW_AT_declaration",
754758
"DW_AT_byte_size",
759+
"DW_AT_data_bit_offset",
755760
"DW_AT_bit_offset",
756761
"DW_AT_specification",
757762
"DW_AT_type",

0 commit comments

Comments
 (0)