]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb/dwarf: clean up some cutu_reader::is_dummy() calls
authorSimon Marchi <simon.marchi@polymtl.ca>
Thu, 24 Apr 2025 20:01:47 +0000 (16:01 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Tue, 29 Apr 2025 19:54:17 +0000 (15:54 -0400)
commitdbfd92856a3cda8fd08a06c150e5c8f5cf8990be
treee64c2dd2534df775e183674db0370fabb80508a6
parent605b4e6f36615974635a17eed999c8ee34821e92
gdb/dwarf: clean up some cutu_reader::is_dummy() calls

This patch tries to standardize the places where we check if units are
dummy.  When checking if a unit is dummy, it is not necessary to check
for some other conditions.

 - cutu_reader::is_dummy() is a superset of cutu_reader::cu() returning
   nullptr, so it's not necessary to check if the cu method return
   nullptr if also checking if the unit is dummy.
 - cutu_reader::is_dummy() is a superset of cutu_reader::top_level_die()
   returning nullptr, so same deal.

Remove some spots that check for these conditions in addition to
cutu_reader::is_dummy().

In addition, also remove the checks for:

    !new_reader->top_level_die ()->has_children

in cooked_indexer::ensure_cu_exists.  IMO, it is not useful to special
case the units having a single DIE.  Especially in this function, which
deals with importing things from another unit, a unit with a single DIE
would be an edge case that should not happen with good debug info.  I
think it's preferable to have simpler code.

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