]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix index's handling of DW_TAG_imported_declaration
authorTom Tromey <tom@tromey.com>
Sun, 19 Jan 2025 23:53:33 +0000 (16:53 -0700)
committerTom Tromey <tom@tromey.com>
Wed, 10 Sep 2025 22:05:27 +0000 (16:05 -0600)
Currently the full symbol reader puts DW_TAG_imported_declaration in
TYPE_DOMAIN, in the global scope.  This patch changes the cooked
indexer to follow.

Without this patch, a later patch in the series would cause
nsalias.exp to regress.

This also updates read-gdb-index.c to do something similar.

Acked-By: Simon Marchi <simon.marchi@efficios.com>
gdb/dwarf2/cooked-indexer.c
gdb/dwarf2/read-gdb-index.c
gdb/dwarf2/tag.h

index ef883259032392e0090a78a7174706418c28f951..31344d7fdaa373c1d976d8ab27540fa35765bac0 100644 (file)
@@ -544,6 +544,11 @@ cooked_indexer::index_dies (cutu_reader *reader,
          flags &= ~IS_STATIC;
          flags |= parent_entry->flags & IS_STATIC;
        }
+      else if (abbrev->tag == DW_TAG_imported_declaration)
+       {
+         /* Match the full reader.  */
+         flags &= ~IS_STATIC;
+       }
 
       if (abbrev->tag == DW_TAG_namespace
          && m_language == language_cplus
index 070239a5b6a396c39eac15f6d126aff339da92a8..beeaa40e56896e8e0f665c6b0d9e66b58c3782a5 100644 (file)
@@ -1100,7 +1100,7 @@ dw2_expand_marked_cus (dwarf2_per_objfile *per_objfile, offset_type idx,
              mask = SEARCH_TYPE_DOMAIN | SEARCH_STRUCT_DOMAIN;
              break;
            case GDB_INDEX_SYMBOL_KIND_OTHER:
-             mask = SEARCH_MODULE_DOMAIN;
+             mask = SEARCH_MODULE_DOMAIN | SEARCH_TYPE_DOMAIN;
              break;
            }
          if ((kind & mask) == 0)
index ed730c01c4041ea71324c42f776d90841bff9f41..a70fca03f2ed5558c313fb8e7969d8d67bfc39c3 100644 (file)
@@ -102,6 +102,10 @@ tag_matches_domain (dwarf_tag tag, domain_search_flags search, language lang)
       }
       break;
 
+    case DW_TAG_imported_declaration:
+      /* DW_TAG_imported_declaration isn't necessarily a type, but the
+        scanner doesn't track the referent, and the full reader
+        also currently puts it in TYPE_DOMAIN.  */
     case DW_TAG_padding:
     case DW_TAG_array_type:
     case DW_TAG_pointer_type: