@@ -175,7 +175,7 @@ class IterableDIEChildren
175
175
176
176
iterator end () const
177
177
{
178
- return iterator (DWARFDIE ());
178
+ return iterator (DWARFDIE (m_die. GetCU (), (DWARFDebugInfoEntry*) nullptr ));
179
179
}
180
180
181
181
private:
@@ -611,38 +611,42 @@ DWARFASTParserRust::ParseFields(const DWARFDIE &die, std::vector<size_t> &discri
611
611
break ;
612
612
}
613
613
}
614
+ }
614
615
615
- if (child_die == discriminant_die) {
616
- // This field is the discriminant, so don't push it, but instead
617
- // record this for the caller.
618
- saw_discr = true ;
619
- discr_offset = new_field.byte_offset ;
620
- discr_byte_size = m_ast.GetBitSize (new_field.compiler_type .GetOpaqueQualType (),
621
- nullptr ) / 8 ;
622
- } else if (child_die.Tag () == DW_TAG_variant_part) {
623
- // New-style enum representation -- nothing useful is in the
624
- // enclosing struct, so we can just recurse here.
625
- return ParseFields (child_die, discriminant_path, is_tuple,
626
- discr_offset, discr_byte_size, saw_discr);
627
- } else {
628
- if (new_field.is_discriminant ) {
629
- // Don't check this field name, and don't increment field_index.
630
- // When we see a tuple with fields like
631
- // RUST$ENUM$DISR
632
- // __0
633
- // __1
634
- // etc
635
- // ... it means the tuple is a member type of an enum.
636
- } else if (numeric_names) {
637
- char buf[32 ];
638
- snprintf (buf, sizeof (buf), " __%u" , field_index);
639
- if (!new_field.name || strcmp (new_field.name , buf) != 0 )
640
- numeric_names = false ;
641
- ++field_index;
642
- }
616
+ if (child_die == discriminant_die) {
617
+ // This field is the discriminant, so don't push it, but instead
618
+ // record this for the caller.
619
+ saw_discr = true ;
620
+ discr_offset = new_field.byte_offset ;
643
621
644
- fields.push_back (new_field);
622
+ Type *type = die.ResolveTypeUID (DIERef (new_field.type ));
623
+ if (type) {
624
+ lldb_private::CompilerType ctype = type->GetFullCompilerType ();
625
+ discr_byte_size = m_ast.GetBitSize (ctype.GetOpaqueQualType (), nullptr ) / 8 ;
645
626
}
627
+ } else if (child_die.Tag () == DW_TAG_variant_part) {
628
+ // New-style enum representation -- nothing useful is in the
629
+ // enclosing struct, so we can just recurse here.
630
+ return ParseFields (child_die, discriminant_path, is_tuple,
631
+ discr_offset, discr_byte_size, saw_discr);
632
+ } else {
633
+ if (new_field.is_discriminant ) {
634
+ // Don't check this field name, and don't increment field_index.
635
+ // When we see a tuple with fields like
636
+ // RUST$ENUM$DISR
637
+ // __0
638
+ // __1
639
+ // etc
640
+ // ... it means the tuple is a member type of an enum.
641
+ } else if (numeric_names) {
642
+ char buf[32 ];
643
+ snprintf (buf, sizeof (buf), " __%u" , field_index);
644
+ if (!new_field.name || strcmp (new_field.name , buf) != 0 )
645
+ numeric_names = false ;
646
+ ++field_index;
647
+ }
648
+
649
+ fields.push_back (new_field);
646
650
}
647
651
}
648
652
0 commit comments