]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
[gdb/symtab] Refactor condition in scan_attributes
authorTom de Vries <tdevries@suse.de>
Mon, 11 Dec 2023 14:41:26 +0000 (15:41 +0100)
committerTom Tromey <tom@tromey.com>
Tue, 16 Apr 2024 17:54:46 +0000 (11:54 -0600)
commit08b91f595d7e2f181e3ac18838ff5a9421aa4d33
tree9853b8fa7586b52dcfa9ff5d08a733d6bcdd7e77
parentb6fc194038ce0744532d6471499326114c0f0d90
[gdb/symtab] Refactor condition in scan_attributes

In scan_attributes there's code:
...
  if (new_reader->cu == reader->cu
      && new_info_ptr > watermark_ptr
      && *parent_entry == nullptr)
    ...
  else if (*parent_entry == nullptr)
    ...
...
that uses the "*parent_entry == nullptr" condition twice.

Make this somewhat more readable by factoring out the condition:
...
  if (*parent_entry == nullptr)
    {
      if (new_reader->cu == reader->cu
  && new_info_ptr > watermark_ptr)
...
      else
...
    }
...

This also allows us to factor out "form_addr (origin_offset, origin_is_dwz)".

Tested on x86_64-linux.
gdb/dwarf2/read.c