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>
nullptr, false, language_minimal,
&abbrev_table_cache);
- if (new_reader->is_dummy () || new_reader->top_level_die () == nullptr
- || !new_reader->top_level_die ()->has_children)
+ if (new_reader->is_dummy ())
return nullptr;
result = m_index_storage->preserve (std::move (new_reader));
}
- if (result->is_dummy () || result->top_level_die () == nullptr
- || !result->top_level_die ()->has_children)
+ if (result->is_dummy ())
return nullptr;
if (for_scanning)
language_minimal,
&abbrev_table_cache);
- if (new_reader->cu () == nullptr || new_reader->is_dummy ())
+ if (new_reader->is_dummy ())
return;
reader = storage->preserve (std::move (new_reader));
}
- if (reader->top_level_die () == nullptr || reader->is_dummy ())
+ if (reader->is_dummy ())
return;
if (this_cu->is_debug_types)