This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Remove some variables in favor of using gdb::optional
- From: Simon Marchi <simon dot marchi at polymtl dot ca>
- To: Tom Tromey <tom at tromey dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Sun, 4 Aug 2019 22:39:16 -0400
- Subject: Re: [PATCH] Remove some variables in favor of using gdb::optional
- Dkim-filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca x752dHCx023281
- References: <20190804201023.25628-1-simon.marchi@polymtl.ca> <874l2wiq3t.fsf@tromey.com>
On 2019-08-04 5:21 p.m., Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:
>
> Simon> While reading that code, I noticed that some variables essentially meant
> Simon> whether to consider some other variable or not. I think using
> Simon> gdb::optional (which was not available when this code was written) is
> Simon> clearer, as it embeds the used/not used predicate directly in the type
> Simon> of the variable, making it harder to miss.
>
> Thanks, this looks reasonable to me.
Thanks, I'll push it momentarily.
> Simon> + /* If set, only look for symbols that match that block. Valid values are
> Simon> + GLOBAL_BLOCK and STATIC_BLOCK. */
> Simon> + gdb::optional<int> block_index;
>
> I guess optional<block_enum> would be even better here.
Yeah, I started doing this, but then thought I would do it as a separate patch, changing
the quick_symbol_functions::lookup_symbol interface, and all it impacts.
Simon