public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdb: add compunit_symtab::add_filetab method
@ 2022-02-06 21:08 Simon Marchi
  0 siblings, 0 replies; only message in thread
From: Simon Marchi @ 2022-02-06 21:08 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=43b49762a17718fe13718238a8c0af9b62b682d4

commit 43b49762a17718fe13718238a8c0af9b62b682d4
Author: Simon Marchi <simon.marchi@efficios.com>
Date:   Fri Nov 19 20:59:59 2021 -0500

    gdb: add compunit_symtab::add_filetab method
    
    Add a method to append a filetab/symtab to a compunit_symtab.  There is
    a single place where this is done currently, in allocate_symtab.
    
    Change-Id: Ie86c6e34d175728173d1cffdce44acd6cff6c31d

Diff:
---
 gdb/symfile.c | 11 +----------
 gdb/symtab.h  | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/gdb/symfile.c b/gdb/symfile.c
index a660422b51e..8ec214fb8e6 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -2804,16 +2804,7 @@ allocate_symtab (struct compunit_symtab *cust, const char *filename)
     }
 
   /* Add it to CUST's list of symtabs.  */
-  if (cust->filetabs == NULL)
-    {
-      cust->filetabs = symtab;
-      cust->last_filetab = symtab;
-    }
-  else
-    {
-      cust->last_filetab->next = symtab;
-      cust->last_filetab = symtab;
-    }
+  cust->add_filetab (symtab);
 
   /* Backlink to the containing compunit symtab.  */
   symtab->compunit_symtab = cust;
diff --git a/gdb/symtab.h b/gdb/symtab.h
index f6d787c45c8..3fa4d5f5d0e 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -1459,6 +1459,20 @@ struct compunit_symtab
     m_objfile = objfile;
   }
 
+  void add_filetab (symtab *filetab)
+  {
+    if (this->filetabs == nullptr)
+      {
+	this->filetabs = filetab;
+	this->last_filetab = filetab;
+      }
+    else
+      {
+	this->last_filetab->next = filetab;
+	this->last_filetab = filetab;
+      }
+  }
+
   /* Return the primary filetab of the compunit.  */
   symtab *primary_filetab () const;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-02-06 21:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-06 21:08 [binutils-gdb] gdb: add compunit_symtab::add_filetab method Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).