@@ -491,7 +491,7 @@ std::vector<DWARFASTParserRust::Field>
491
491
DWARFASTParserRust::ParseFields (const DWARFDIE &die, std::vector<size_t > &discriminant_path,
492
492
bool &is_tuple,
493
493
uint64_t &discr_offset, uint64_t &discr_byte_size,
494
- bool &saw_discr) {
494
+ bool &saw_discr, std::vector<CompilerType> &template_params ) {
495
495
SymbolFileDWARF *dwarf = die.GetDWARF ();
496
496
497
497
// We construct a list of fields and then apply them later so that
@@ -631,8 +631,8 @@ DWARFASTParserRust::ParseFields(const DWARFDIE &die, std::vector<size_t> &discri
631
631
// New-style enum representation -- nothing useful is in the
632
632
// enclosing struct, so we can just recurse here.
633
633
return ParseFields (child_die, discriminant_path, is_tuple,
634
- discr_offset, discr_byte_size, saw_discr);
635
- } else {
634
+ discr_offset, discr_byte_size, saw_discr, template_params );
635
+ } else if (child_die. Tag () == DW_TAG_member) {
636
636
if (new_field.is_discriminant ) {
637
637
// Don't check this field name, and don't increment field_index.
638
638
// When we see a tuple with fields like
@@ -650,6 +650,11 @@ DWARFASTParserRust::ParseFields(const DWARFDIE &die, std::vector<size_t> &discri
650
650
}
651
651
652
652
fields.push_back (new_field);
653
+ } else if (child_die.Tag () == DW_TAG_template_type_parameter) {
654
+ Type *param_type = dwarf->ResolveTypeUID (child_die, true );
655
+ if (param_type) {
656
+ template_params.push_back (param_type->GetForwardCompilerType ());
657
+ }
653
658
}
654
659
}
655
660
@@ -728,8 +733,10 @@ TypeSP DWARFASTParserRust::ParseStructureType(const DWARFDIE &die) {
728
733
bool saw_discr = false ;
729
734
uint64_t discr_offset, discr_byte_size;
730
735
std::vector<size_t > discriminant_path;
736
+ std::vector<CompilerType> template_params;
731
737
std::vector<Field> fields = ParseFields (die, discriminant_path, is_tuple,
732
- discr_offset, discr_byte_size, saw_discr);
738
+ discr_offset, discr_byte_size, saw_discr,
739
+ template_params);
733
740
734
741
// This is true if this is a union, there are multiple fields and
735
742
// each field's type has a discriminant.
@@ -834,6 +841,9 @@ TypeSP DWARFASTParserRust::ParseStructureType(const DWARFDIE &die) {
834
841
}
835
842
}
836
843
844
+ for (const CompilerType ¶m_type : template_params)
845
+ m_ast.AddTemplateParameter (compiler_type, param_type);
846
+
837
847
m_ast.FinishAggregateInitialization (compiler_type);
838
848
839
849
// Add our type to the unique type map so we don't
0 commit comments