[binutils-gdb] Don't call add_dependence from index_imported_unit

Tom Tromey via Gdb-cvs <[email protected]>
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5112acfca5bccc6c78e1add6fc95ad903b36c783

commit 5112acfca5bccc6c78e1add6fc95ad903b36c783
Author: Tom Tromey <[email protected]>
Date:   Fri Mar 28 14:33:42 2025 -0600

    Don't call add_dependence from index_imported_unit
    
    cooked_indexer::index_imported_unit calls add_dependence.  However,
    this field is only needed during full symbol reading.  Remove this
    call.
    
    Acked-By: Tom de Vries <[email protected]>
    Approved-By: Simon Marchi <[email protected]>

Diff:
---
 gdb/dwarf2/cooked-indexer.c | 6 +-----
 gdb/dwarf2/cu.h             | 6 +++---
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/gdb/dwarf2/cooked-indexer.c b/gdb/dwarf2/cooked-indexer.c
index 302b4a6d6a0..230f6408ddb 100644
--- a/gdb/dwarf2/cooked-indexer.c
+++ b/gdb/dwarf2/cooked-indexer.c
@@ -430,11 +430,7 @@ cooked_indexer::index_imported_unit (cutu_reader *reader,
   cutu_reader *new_reader
     = ensure_cu_exists (reader, *target, true);
   if (new_reader != nullptr)
-    {
-      index_dies (new_reader, new_reader->info_ptr (), nullptr, false);
-
-      reader->cu ()->add_dependence (new_reader->cu ()->per_cu);
-    }
+    index_dies (new_reader, new_reader->info_ptr (), nullptr, false);
 
   return info_ptr;
 }
diff --git a/gdb/dwarf2/cu.h b/gdb/dwarf2/cu.h
index 41c1d5717cd..9b90415ed64 100644
--- a/gdb/dwarf2/cu.h
+++ b/gdb/dwarf2/cu.h
@@ -300,9 +300,9 @@ private:
      symbols are being read.  */
   buildsym_compunit_up m_builder;
 
-  /* A set of pointers to dwarf2_per_cu objects for compilation units referenced
-     by this one.  Only used during full symbol processing; partial symbol
-     tables do not have dependencies.  */
+  /* A set of pointers to dwarf2_per_cu objects for compilation units
+     referenced by this one.  Only used during full symbol
+     processing.  */
   gdb::unordered_set<dwarf2_per_cu *> m_dependencies;
 
 public:
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.