public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [RFA] Remove a VEC from dwarf2read.c
Date: Fri, 08 Jun 2018 04:52:00 -0000	[thread overview]
Message-ID: <20180608045232.19342-1-tom@tromey.com> (raw)

This removes a VEC from dwarf2read.c, replacing it with a std::vector.

Tested by the buildbot.

gdb/ChangeLog
2018-06-07  Tom Tromey  <tom@tromey.com>

	* dwarf2read.c (process_cu_includes): Update.
	(process_full_comp_unit): Update.
	* dwarf2read.h (struct dwarf2_per_objfile) <just_read_cus>: Now a
	std::vector.
---
 gdb/ChangeLog    |  7 +++++++
 gdb/dwarf2read.c | 12 +++---------
 gdb/dwarf2read.h |  2 +-
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 1cabfbb0d45..7f1857930b1 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -10217,19 +10217,13 @@ compute_compunit_symtab_includes (struct dwarf2_per_cu_data *per_cu)
 static void
 process_cu_includes (struct dwarf2_per_objfile *dwarf2_per_objfile)
 {
-  int ix;
-  struct dwarf2_per_cu_data *iter;
-
-  for (ix = 0;
-       VEC_iterate (dwarf2_per_cu_ptr, dwarf2_per_objfile->just_read_cus,
-		    ix, iter);
-       ++ix)
+  for (struct dwarf2_per_cu_data *iter : dwarf2_per_objfile->just_read_cus)
     {
       if (! iter->is_debug_types)
 	compute_compunit_symtab_includes (iter);
     }
 
-  VEC_free (dwarf2_per_cu_ptr, dwarf2_per_objfile->just_read_cus);
+  dwarf2_per_objfile->just_read_cus.clear ();
 }
 
 /* Generate full symbol information for PER_CU, whose DIEs have
@@ -10337,7 +10331,7 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu,
     }
 
   /* Push it for inclusion processing later.  */
-  VEC_safe_push (dwarf2_per_cu_ptr, dwarf2_per_objfile->just_read_cus, per_cu);
+  dwarf2_per_objfile->just_read_cus.push_back (per_cu);
 }
 
 /* Generate full symbol information for type unit PER_CU, whose DIEs have
diff --git a/gdb/dwarf2read.h b/gdb/dwarf2read.h
index fbac7171deb..74335d77db0 100644
--- a/gdb/dwarf2read.h
+++ b/gdb/dwarf2read.h
@@ -233,7 +233,7 @@ public:
   htab_t die_type_hash {};
 
   /* The CUs we recently read.  */
-  VEC (dwarf2_per_cu_ptr) *just_read_cus = NULL;
+  std::vector<dwarf2_per_cu_data *> just_read_cus;
 
   /* Table containing line_header indexed by offset and offset_in_dwz.  */
   htab_t line_header_hash {};
-- 
2.13.6

             reply	other threads:[~2018-06-08  4:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-08  4:52 Tom Tromey [this message]
2018-06-09 12:07 ` Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180608045232.19342-1-tom@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).