]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb/dwarf: avoid cutu_reader moves
authorSimon Marchi <simon.marchi@polymtl.ca>
Thu, 24 Apr 2025 20:01:46 +0000 (16:01 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Tue, 29 Apr 2025 19:54:13 +0000 (15:54 -0400)
commit605b4e6f36615974635a17eed999c8ee34821e92
treea53b3d63af077885162ce7babbed4ada5e577089
parent28f15782adab4e8f984c065e0c793c716dd942f2
gdb/dwarf: avoid cutu_reader moves

In process_psymtab_comp_unit and ensure_cu_exists, we create a temporary
cutu_reader on the stack, then move it to a heap allocated cutu_reader
once we confirmed the unit is not dummy.  I think it's unnecessary to
create a temporary cutu_reader.  The only downside of not doing so is that if it
ends up that the CU is dummy, we made an allocation/deallocation for
nothing.  Dummy CUs are a rare thing, it shouldn't change anything.

This allows removing the cutu_reader move constructor.

Change-Id: I44742d471c495055ee46db41c0e7bdfbd2d5c0b7
Approved-By: Tom Tromey <tom@tromey.com>
gdb/dwarf2/cooked-indexer.c
gdb/dwarf2/read.c
gdb/dwarf2/read.h