aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-05-31 12:33:32 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2021-05-31 12:33:32 -0400
commit46c6bcf650644ae22941ccb49dfe5fbb6e185513 (patch)
treefd293641520b7642c01154748c0b3112c88c12fd
parent4631503b28f63cfa66a363008d714a94c2c71e06 (diff)
downloadgdb-46c6bcf650644ae22941ccb49dfe5fbb6e185513.zip
gdb-46c6bcf650644ae22941ccb49dfe5fbb6e185513.tar.gz
gdb-46c6bcf650644ae22941ccb49dfe5fbb6e185513.tar.bz2
gdb: add and use signatured_type_up
Add an alias for std::unique_ptr<signatured_type> and use it where possible. gdb/ChangeLog: * dwarf2/read.h (signatured_type_up): New, use where possible. Change-Id: I5a41e8345551434c8beeb9f269b03bdcf27989be
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/dwarf2/read.c12
-rw-r--r--gdb/dwarf2/read.h4
3 files changed, 13 insertions, 7 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a570dfe..98afac5 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
2021-05-31 Simon Marchi <simon.marchi@polymtl.ca>
+ * dwarf2/read.h (signatured_type_up): New, use where possible.
+
+2021-05-31 Simon Marchi <simon.marchi@polymtl.ca>
+
* dwarf2/read.h (signatured_type, dwarf2_per_cu_data): Move up.
2021-05-30 Tom Tromey <tom@tromey.com>
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 9e5c3af..24247de 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -2294,10 +2294,10 @@ dwarf2_per_bfd::allocate_per_cu ()
/* See read.h. */
-std::unique_ptr<signatured_type>
+signatured_type_up
dwarf2_per_bfd::allocate_signatured_type ()
{
- std::unique_ptr<signatured_type> result (new signatured_type);
+ signatured_type_up result (new signatured_type);
result->per_bfd = this;
result->index = all_comp_units.size ();
result->is_debug_types = true;
@@ -2382,7 +2382,7 @@ create_signatured_type_table_from_index
for (offset_type i = 0; i < elements; i += 3)
{
- std::unique_ptr<signatured_type> sig_type;
+ signatured_type_up sig_type;
ULONGEST signature;
void **slot;
cu_offset type_offset_in_tu;
@@ -2432,7 +2432,7 @@ create_signatured_type_table_from_debug_names
for (uint32_t i = 0; i < map.tu_count; ++i)
{
- std::unique_ptr<signatured_type> sig_type;
+ signatured_type_up sig_type;
void **slot;
sect_offset sect_off
@@ -5796,7 +5796,7 @@ create_debug_type_hash_table (dwarf2_per_objfile *per_objfile,
end_ptr = info_ptr + section->size;
while (info_ptr < end_ptr)
{
- std::unique_ptr<signatured_type> sig_type;
+ signatured_type_up sig_type;
struct dwo_unit *dwo_tu;
void **slot;
const gdb_byte *ptr = info_ptr;
@@ -5886,7 +5886,7 @@ add_type_unit (dwarf2_per_objfile *per_objfile, ULONGEST sig, void **slot)
== per_objfile->per_bfd->all_comp_units.capacity ())
++per_objfile->per_bfd->tu_stats.nr_all_type_units_reallocs;
- std::unique_ptr<signatured_type> sig_type_holder
+ signatured_type_up sig_type_holder
= per_objfile->per_bfd->allocate_signatured_type ();
signatured_type *sig_type = sig_type_holder.get ();
diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h
index 44ba1a6..9893791 100644
--- a/gdb/dwarf2/read.h
+++ b/gdb/dwarf2/read.h
@@ -305,6 +305,8 @@ struct signatured_type : public dwarf2_per_cu_data
struct dwo_unit *dwo_unit = nullptr;
};
+using signatured_type_up = std::unique_ptr<signatured_type>;
+
/* Some DWARF data can be shared across objfiles who share the same BFD,
this data is stored in this object.
@@ -339,7 +341,7 @@ struct dwarf2_per_bfd
/* A convenience function to allocate a signatured_type. The
returned object has its "index" field set properly. The object
is allocated on the dwarf2_per_bfd obstack. */
- std::unique_ptr<signatured_type> allocate_signatured_type ();
+ signatured_type_up allocate_signatured_type ();
private:
/* This function is mapped across the sections and remembers the