[10/13] Use attribute::signed_constant in attribute::as_boolean
Checks
Commit Message
This changes attribute::as_boolean to use attribute::signed_constant.
This is maybe overkill but lets any reasonable constant form through.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32680
---
gdb/dwarf2/attribute.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
@@ -323,5 +323,8 @@ attribute::as_boolean () const
return true;
else if (form == DW_FORM_flag)
return u.unsnd != 0;
- return constant_value (0) != 0;
+ /* Using signed_constant here will work even for the weird case
+ where a negative value is provided. Probably doesn't matter but
+ also seems harmless. */
+ return signed_constant ().value_or (0) != 0;
}