diff options
author | Xavier Roirand <roirand@adacore.com> | 2018-09-10 10:35:58 -0500 |
---|---|---|
committer | Joel Brobecker <brobecker@adacore.com> | 2018-09-10 11:35:58 -0400 |
commit | d91e9ea81dce83259f2a7f32f43876373f3e7981 (patch) | |
tree | 63b8cff9aa5180065b7274341bbf604cf58be58e /gdb/ada-varobj.c | |
parent | cc330e39bc938cefd4cfc581639177ef4c6bcbe3 (diff) | |
download | fsf-binutils-gdb-d91e9ea81dce83259f2a7f32f43876373f3e7981.zip fsf-binutils-gdb-d91e9ea81dce83259f2a7f32f43876373f3e7981.tar.gz fsf-binutils-gdb-d91e9ea81dce83259f2a7f32f43876373f3e7981.tar.bz2 |
(Ada) Cleanup code by using ada_is_access_to_unconstrained_array call.
This patch just avoids code duplication by using a function we
introduced recently (ada_is_access_to_unconstrained_array).
gdb/ChangeLog:
* ada-lang.c (ada_is_access_to_unconstrained_array): Remove static
declaration.
* ada-lang.h: add ada_is_access_to_unconstrained_array prototype.
* ada-varobj.c (ada_varobj_get_number_of_children,
ada_varobj_describe_child, ada_value_is_changeable_p): Cleanup code.
Tested on x86_64-linux.
No new testcase provided, as this is just a refactoring.
Diffstat (limited to 'gdb/ada-varobj.c')
-rw-r--r-- | gdb/ada-varobj.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/gdb/ada-varobj.c b/gdb/ada-varobj.c index 5baefd9..8a01cb9 100644 --- a/gdb/ada-varobj.c +++ b/gdb/ada-varobj.c @@ -350,8 +350,7 @@ ada_varobj_get_number_of_children (struct value *parent_value, /* A typedef to an array descriptor in fact represents a pointer to an unconstrained array. These types always have one child (the unconstrained array). */ - if (ada_is_array_descriptor_type (parent_type) - && TYPE_CODE (parent_type) == TYPE_CODE_TYPEDEF) + if (ada_is_access_to_unconstrained_array (parent_type)) return 1; if (TYPE_CODE (parent_type) == TYPE_CODE_ARRAY) @@ -680,8 +679,7 @@ ada_varobj_describe_child (struct value *parent_value, if (child_path_expr) *child_path_expr = std::string (); - if (ada_is_array_descriptor_type (parent_type) - && TYPE_CODE (parent_type) == TYPE_CODE_TYPEDEF) + if (ada_is_access_to_unconstrained_array (parent_type)) { ada_varobj_describe_ptr_child (parent_value, parent_type, parent_name, parent_path_expr, @@ -937,8 +935,7 @@ ada_value_is_changeable_p (const struct varobj *var) struct type *type = (var->value != nullptr ? value_type (var->value.get ()) : var->type); - if (ada_is_array_descriptor_type (type) - && TYPE_CODE (type) == TYPE_CODE_TYPEDEF) + if (ada_is_access_to_unconstrained_array (type)) { /* This is in reality a pointer to an unconstrained array. its value is changeable. */ |