From: Simon Marchi <simark@simark.ca>
To: Tom de Vries <tdevries@suse.de>, Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v2 2/5] [gdb] Make addrmap_mutable::insert_empty return bool
Date: Sat, 23 Aug 2025 13:53:30 -0400 [thread overview]
Message-ID: <b52daa9a-4898-4a89-90e7-7ee8e80759a3@simark.ca> (raw)
In-Reply-To: <e49bd2f4-4e0b-485d-8bd7-ea9522a51395@suse.de>
On 2025-08-23 00:20, Tom de Vries wrote:
> On 8/22/25 20:51, Tom Tromey wrote:
>>>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
>>
>> Tom> @@ -234,8 +235,14 @@ addrmap_mutable::set_empty (CORE_ADDR start, CORE_ADDR end_inclusive,
>> Tom> n && addrmap_node_key (n) <= end_inclusive;
>> Tom> n = splay_tree_successor (addrmap_node_key (n)))
>> Tom> {
>> Tom> - if (! addrmap_node_value (n))
>> Tom> - addrmap_node_set_value (n, obj);
>> Tom> + if (addrmap_node_value (n))
>> Tom> + {
>> Tom> + /* Already mapped. */
>> Tom> + full_range = false;
>> Tom> + continue;
>> Tom> + }
>> Tom> +
>> Tom> + addrmap_node_set_value (n, obj);
>>
>> I think using 'else' here would be better than 'continue', since loop
>> short-circuits are harder to understand.
>
> Hi Tom,
>
> thanks for the review.
>
> I've pushed this using an if/else.
>
> FWIW, I still think that they way I wrote is is much better. My opinion is based on this coding standard rule ( https://llvm.org/docs/CodingStandards.html#use-early-exits-and-continue-to-simplify-code ).
I also like early returns and early continue in loops. It tells me: you
don't need to think about that case for the rest of the function loop.
Simon
next prev parent reply other threads:[~2025-08-23 17:54 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-21 13:31 [PATCH v2 0/5] [gdb/symtab] Handle invalid .gdb_index better Tom de Vries
2025-08-21 13:31 ` [PATCH v2 1/5] [gdb/symtab] Bail out of create_addrmap_from_gdb_index on error Tom de Vries
2025-08-21 13:31 ` [PATCH v2 2/5] [gdb] Make addrmap_mutable::insert_empty return bool Tom de Vries
2025-08-22 14:54 ` Simon Marchi
2025-08-22 18:51 ` Tom Tromey
2025-08-23 4:20 ` Tom de Vries
2025-08-23 17:53 ` Simon Marchi [this message]
2025-08-29 0:20 ` Tom Tromey
2025-08-29 8:28 ` Tom de Vries
2025-08-21 13:31 ` [PATCH v2 3/5] [gdb/symtab] Detect overlapping ranges in create_addrmap_from_gdb_index Tom de Vries
2025-08-22 14:57 ` Simon Marchi
2025-08-21 13:31 ` [PATCH v2 4/5] [gdb/symtab] Improve invalid range check " Tom de Vries
2025-08-22 14:56 ` Tom de Vries
2025-08-22 15:17 ` Simon Marchi
2025-08-22 18:53 ` Tom Tromey
2025-08-23 4:33 ` Tom de Vries
2025-08-21 13:31 ` [PATCH v2 5/5] [gdb/symtab] Turn complaints in create_addrmap_from_gdb_index into warnings Tom de Vries
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b52daa9a-4898-4a89-90e7-7ee8e80759a3@simark.ca \
--to=simark@simark.ca \
--cc=gdb-patches@sourceware.org \
--cc=tdevries@suse.de \
--cc=tom@tromey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox