]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb/dwarf: change signatured_type_up to include deleter type
authorSimon Marchi <simon.marchi@polymtl.ca>
Wed, 20 May 2026 18:19:28 +0000 (14:19 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Thu, 21 May 2026 17:45:15 +0000 (13:45 -0400)
commit2b0b2caa44833de42dace04e681c4e5e79402231
tree725acb1b7d3d3f51b23d77f0b5625cd55aa28754
parentea27a7ae9048367bde15246b248f856803efc674
gdb/dwarf: change signatured_type_up to include deleter type

We currently have:

  using dwarf2_per_cu_up = std::unique_ptr<dwarf2_per_cu, dwarf2_per_cu_deleter>;
  using signatured_type_up = std::unique_ptr<signatured_type>;

Meaning that it's not possible to pass a signatured_type_up as a
dwarf2_per_cu_up, even though the target types are related (it is
possible to pass a `signatured_type *` as a `dwarf2_per_cu *`).

If we give signatured_type_up the same deleter as dwarf2_per_cu_up, then
it becomes possible to pass a signatured_type_up as a dwarf2_per_cu_up.
This lets us avoid releasing a signatured_type_up only to create a
dwarf2dwarf2_per_cu_up immediately after in some spots.  The only
downside is that we can't use make_unique anymore, but it's already the
case for dwarf2_per_cu_up.

Swap the order of things in add_type_unit so that we don't need a
special holder variable.

Change-Id: Iee34e5d1711d601297f109e58cbaeccb5a0c6cde
Approved-By: Tom Tromey <tom@tromey.com>
gdb/dwarf2/read-debug-names.c
gdb/dwarf2/read-gdb-index.c
gdb/dwarf2/read.c
gdb/dwarf2/read.h