aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2/attribute.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/dwarf2/attribute.c')
-rw-r--r--gdb/dwarf2/attribute.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gdb/dwarf2/attribute.c b/gdb/dwarf2/attribute.c
index 95c5fe4..0bbd0da 100644
--- a/gdb/dwarf2/attribute.c
+++ b/gdb/dwarf2/attribute.c
@@ -245,3 +245,15 @@ attribute::as_virtuality () const
plongest (value));
return DW_VIRTUALITY_none;
}
+
+/* See attribute.h. */
+
+bool
+attribute::as_boolean () const
+{
+ if (form == DW_FORM_flag_present)
+ return true;
+ else if (form == DW_FORM_flag)
+ return u.unsnd != 0;
+ return constant_value (0) != 0;
+}