IS_ENUM_CLASS = 4,
/* True if this entry uses the linkage name. */
IS_LINKAGE = 8,
+ /* True if this entry is just for the declaration of a type, not the
+ definition. */
+ IS_TYPE_DECLARATION = 16,
};
DEF_ENUM_FLAGS_TYPE (enum cooked_index_flag_enum, cooked_index_flag);
/* Return true if this entry matches SEARCH_FLAGS. */
bool matches (block_search_flags search_flags) const
{
+ /* Just reject type declarations. */
+ if ((flags & IS_TYPE_DECLARATION) != 0)
+ return false;
+
if ((search_flags & SEARCH_STATIC_BLOCK) != 0
&& (flags & IS_STATIC) != 0)
return true;
/* Return true if this entry matches DOMAIN. */
bool matches (domain_enum domain) const
{
+ /* Just reject type declarations. */
+ if ((flags & IS_TYPE_DECLARATION) != 0)
+ return false;
+
switch (domain)
{
case LABEL_DOMAIN:
/* Return true if this entry matches KIND. */
bool matches (enum search_domain kind) const
{
+ /* Just reject type declarations. */
+ if ((flags & IS_TYPE_DECLARATION) != 0)
+ return false;
+
switch (kind)
{
case VARIABLES_DOMAIN:
be redundant are rare and not worth supporting. */
continue;
}
+ else if ((entry->flags & IS_TYPE_DECLARATION) != 0)
+ {
+ /* Don't add type declarations to the index. */
+ continue;
+ }
gdb_index_symbol_kind kind;
if (entry->tag == DW_TAG_subprogram)
that is ok. Similarly, we allow an external variable without a
location; those are resolved via minimal symbols. */
if (is_declaration && !for_specification
- && !(abbrev->tag == DW_TAG_variable && (*flags & IS_STATIC) == 0)
- && !((abbrev->tag == DW_TAG_class_type
- || abbrev->tag == DW_TAG_structure_type
- || abbrev->tag == DW_TAG_union_type)
- && abbrev->has_children))
- {
- *linkage_name = nullptr;
- *name = nullptr;
+ && !(abbrev->tag == DW_TAG_variable && (*flags & IS_STATIC) == 0))
+ {
+ /* We always want to recurse into some types, but we may not
+ want to treat them as definitions. */
+ if ((abbrev->tag == DW_TAG_class_type
+ || abbrev->tag == DW_TAG_structure_type
+ || abbrev->tag == DW_TAG_union_type)
+ && abbrev->has_children)
+ *flags |= IS_TYPE_DECLARATION;
+ else
+ {
+ *linkage_name = nullptr;
+ *name = nullptr;
+ }
}
else if ((*name == nullptr
|| (*linkage_name == nullptr