[RFA] Use std::unique_ptr in dwarf2_read_debug_names

Message ID 87muwt2f7s.fsf@tromey.com
State New, archived
Headers

Commit Message

Tom Tromey May 21, 2018, 3:36 p.m. UTC
  >>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:

Simon> We maybe could add DISABLE_COPY_AND_ASSIGN to mapped_index_base, to ensure
Simon> we don't make copies of mapped_index/mapped_debug_names by mistake.

I also needed to default the no-arg constructor.
I'm checking it in with the appended addition.

Tom
  

Patch

diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 9a77502826..49ce83ff20 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -147,6 +147,9 @@  struct name_component
 
 struct mapped_index_base
 {
+  mapped_index_base () = default;
+  DISABLE_COPY_AND_ASSIGN (mapped_index_base);
+
   /* The name_component table (a sorted vector).  See name_component's
      description above.  */
   std::vector<name_component> name_components;