aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-lang.c
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2021-06-22 19:27:53 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2021-06-25 20:43:06 +0100
commit158cc4feb72a471dd4478766e711326b0e97f3b6 (patch)
tree05613a2324b85ec6984848e6e9e372c653959e98 /gdb/ada-lang.c
parent13221aec0d87c701c463d4fa54aa70096d0f43a7 (diff)
downloadgdb-158cc4feb72a471dd4478766e711326b0e97f3b6.zip
gdb-158cc4feb72a471dd4478766e711326b0e97f3b6.tar.gz
gdb-158cc4feb72a471dd4478766e711326b0e97f3b6.tar.bz2
gdb: use gdb::optional instead of passing a pointer to gdb::array_view
Following on from the previous commit, this commit changes the API of value_struct_elt to take gdb::optional<gdb::array_view<value *>> instead of a pointer to the gdb::array_view. This makes the optional nature of the array_view parameter explicit. This commit is purely a refactoring commit, there should be no user visible change after this commit. I have deliberately kept this refactor separate from the previous two commits as this is a more extensive change, and I'm not 100% sure that using gdb::optional for the parameter type, instead of a pointer, is going to be to everyone's taste. If there's push back on this patch then this one can be dropped from the series. gdb/ChangeLog: * ada-lang.c (desc_bounds): Use '{}' instead of NULL to indicate an empty gdb::optional when calling value_struct_elt. (desc_data): Likewise. (desc_one_bound): Likewise. * eval.c (structop_base_operation::evaluate_funcall): Pass gdb::array_view, not a gdb::array_view* to value_struct_elt. (eval_op_structop_struct): Use '{}' instead of NULL to indicate an empty gdb::optional when calling value_struct_elt. (eval_op_structop_ptr): Likewise. * f-lang.c (fortran_structop_operation::evaluate): Likewise. * guile/scm-value.c (gdbscm_value_field): Likewise. * m2-lang.c (eval_op_m2_high): Likewise. (eval_op_m2_subscript): Likewise. * opencl-lang.c (opencl_structop_operation::evaluate): Likewise. * python/py-value.c (valpy_getitem): Likewise. * rust-lang.c (rust_val_print_str): Likewise. (rust_range): Likewise. (rust_subscript): Likewise. (eval_op_rust_structop): Likewise. (rust_aggregate_operation::evaluate): Likewise. * valarith.c (value_user_defined_op): Likewise. * valops.c (search_struct_method): Change parameter type, update function body accordingly, and update header comment. (value_struct_elt): Change parameter type, update function body accordingly. * value.h (value_struct_elt): Update declaration.
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r--gdb/ada-lang.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 49a7d5b..f2270c0 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -1484,7 +1484,7 @@ desc_bounds (struct value *arr)
else if (is_thick_pntr (type))
{
- struct value *p_bounds = value_struct_elt (&arr, NULL, "P_BOUNDS", NULL,
+ struct value *p_bounds = value_struct_elt (&arr, {}, "P_BOUNDS", NULL,
_("Bad GNAT array descriptor"));
struct type *p_bounds_type = value_type (p_bounds);
@@ -1566,7 +1566,7 @@ desc_data (struct value *arr)
if (is_thin_pntr (type))
return thin_data_pntr (arr);
else if (is_thick_pntr (type))
- return value_struct_elt (&arr, NULL, "P_ARRAY", NULL,
+ return value_struct_elt (&arr, {}, "P_ARRAY", NULL,
_("Bad GNAT array descriptor"));
else
return NULL;
@@ -1606,7 +1606,7 @@ desc_one_bound (struct value *bounds, int i, int which)
char bound_name[20];
xsnprintf (bound_name, sizeof (bound_name), "%cB%d",
which ? 'U' : 'L', i - 1);
- return value_struct_elt (&bounds, NULL, bound_name, NULL,
+ return value_struct_elt (&bounds, {}, bound_name, NULL,
_("Bad GNAT array descriptor bounds"));
}