]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Add compunit_symtab::forget_cached_source_info
authorTom Tromey <tromey@adacore.com>
Wed, 5 Jun 2024 15:06:30 +0000 (09:06 -0600)
committerTom Tromey <tromey@adacore.com>
Mon, 24 Jun 2024 15:11:30 +0000 (09:11 -0600)
It seemed cleaner to me for compunit_symtab to have a
forget_cached_source_info method, then for the objfile to know how to
do this.

gdb/symfile-debug.c
gdb/symtab.c
gdb/symtab.h

index 39128894a5c059bd09764f69535e67670a91f5ea..3a223d0789e50a01bfc90c951d12f9512c02b3aa 100644 (file)
@@ -154,10 +154,7 @@ objfile::forget_cached_source_info ()
                objfile_debug_name (this));
 
   for (compunit_symtab *cu : compunits ())
-    {
-      for (symtab *s : cu->filetabs ())
-       s->release_fullname ();
-    }
+    cu->forget_cached_source_info ();
 
   for (const auto &iter : qf)
     iter->forget_cached_source_info (this);
index 4888ebcbf68c914d490cb3680a2c619e7f9b2e98..39a6915ee76ecfcf4fa4b66c0e92af1a8f394d30 100644 (file)
@@ -485,6 +485,15 @@ compunit_symtab::language () const
   return symtab->language ();
 }
 
+/* See symtab.h.  */
+
+void
+compunit_symtab::forget_cached_source_info ()
+{
+  for (symtab *s : filetabs ())
+    s->release_fullname ();
+}
+
 /* The relocated address of the minimal symbol, using the section
    offsets from OBJFILE.  */
 
index 19bb697a5a112822197d251040a9a8bd82089786..d0b599fc58e189acdbeb1e6a09e8228e960146ff 100644 (file)
@@ -1965,6 +1965,9 @@ struct compunit_symtab
   /* Return the language of this compunit_symtab.  */
   enum language language () const;
 
+  /* Clear any cached source file names.  */
+  void forget_cached_source_info ();
+
   /* Unordered chain of all compunit symtabs of this objfile.  */
   struct compunit_symtab *next;