This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Remove some variables in favor of using gdb::optional


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]