- cur_abbrev->attrs =
- XOBNEWVEC (&abbrev_table->m_abbrev_obstack, struct attr_abbrev,
- cur_abbrev->num_attrs);
- memcpy (cur_abbrev->attrs, cur_attrs.data (),
- cur_abbrev->num_attrs * sizeof (struct attr_abbrev));
-
- abbrev_table->add_abbrev (abbrev_number, cur_abbrev);
-
- /* Get next abbreviation.
- Under Irix6 the abbreviations for a compilation unit are not
- always properly terminated with an abbrev number of 0.
- Exit loop if we encounter an abbreviation which we have
- already read (which means we are about to read the abbreviations
- for the next compile unit) or if the end of the abbreviation
- table is reached. */
- if ((unsigned int) (abbrev_ptr - section->buffer) >= section->size)
- break;
- abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
- abbrev_ptr += bytes_read;
- if (abbrev_table->lookup_abbrev (abbrev_number) != NULL)
- break;
+ cur_abbrev = (struct abbrev_info *) obstack_finish (obstack);
+ cur_abbrev->num_attrs = num_attrs;
+
+ if (!has_name && !has_linkage_name && !has_specification_or_origin)
+ {
+ /* Some anonymous DIEs are worth examining. */
+ cur_abbrev->interesting
+ = (cur_abbrev->tag == DW_TAG_namespace
+ || cur_abbrev->tag == DW_TAG_enumeration_type);
+ }
+ else if ((cur_abbrev->tag == DW_TAG_structure_type
+ || cur_abbrev->tag == DW_TAG_class_type
+ || cur_abbrev->tag == DW_TAG_union_type)
+ && cur_abbrev->has_children)
+ {
+ /* We have to record this as interesting, regardless of how
+ DW_AT_declaration is set, so that any subsequent
+ DW_AT_specification pointing at a child of this will get
+ the correct scope. */
+ cur_abbrev->interesting = true;
+ }
+ else if (has_hardcoded_declaration
+ && (cur_abbrev->tag != DW_TAG_variable || !has_external))
+ cur_abbrev->interesting = false;
+ else if (!tag_interesting_for_index (cur_abbrev->tag))
+ cur_abbrev->interesting = false;
+ else if (!has_location && !has_specification_or_origin && !has_external
+ && cur_abbrev->tag == DW_TAG_variable)
+ cur_abbrev->interesting = false;
+ else
+ cur_abbrev->interesting = true;
+
+ /* If there are no children, and the abbrev has a constant size,
+ then we don't care about the sibling offset, because it's
+ simple to just skip the entire DIE without reading a sibling
+ offset. */
+ if ((!cur_abbrev->has_children && is_csize)
+ /* Overflow. */
+ || sibling_offset != (unsigned short) sibling_offset)
+ sibling_offset = -1;
+ cur_abbrev->size_if_constant = is_csize ? size : 0;
+ cur_abbrev->sibling_offset = sibling_offset;
+
+ abbrev_table->add_abbrev (cur_abbrev);