gdb: remove unnecessary NULL checks for return value of value_from_register
Checks
Commit Message
value_from_register can't return nullptr, remove some NULL checks.
Change-Id: Ia6b32b8f86e593c535e3678a89dffe5544eb7ab0
---
gdb/findvar.c | 23 +++--------------------
1 file changed, 3 insertions(+), 20 deletions(-)
base-commit: dbca3300ea7ad55dfd3dfed29d8a6386736138cd
Comments
>>>>> "Simon" == Simon Marchi <simon.marchi@efficios.com> writes:
Simon> value_from_register can't return nullptr, remove some NULL checks.
Ok.
Approved-By: Tom Tromey <tom@tromey.com>
Tom
On 1/19/24 11:26, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simon.marchi@efficios.com> writes:
>
> Simon> value_from_register can't return nullptr, remove some NULL checks.
>
> Ok.
> Approved-By: Tom Tromey <tom@tromey.com>
>
> Tom
Thanks, pushed.
Simon
@@ -623,29 +623,12 @@ language_defn::read_var_value (struct symbol *var,
{
int regno = SYMBOL_REGISTER_OPS (var)
->register_number (var, get_frame_arch (frame));
- struct value *regval;
if (var->aclass () == LOC_REGPARM_ADDR)
- {
- regval = value_from_register (lookup_pointer_type (type),
- regno,
- frame);
-
- if (regval == NULL)
- error (_("Value of register variable not available for `%s'."),
- var->print_name ());
-
- addr = value_as_address (regval);
- }
+ addr = value_as_address
+ (value_from_register (lookup_pointer_type (type), regno, frame));
else
- {
- regval = value_from_register (type, regno, frame);
-
- if (regval == NULL)
- error (_("Value of register variable not available for `%s'."),
- var->print_name ());
- return regval;
- }
+ return value_from_register (type, regno, frame);
}
break;