aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbtypes.h
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2020-12-09 13:51:45 -0500
committerSimon Marchi <simon.marchi@polymtl.ca>2020-12-09 13:51:45 -0500
commit6244c1196a49a5732ac3667b4df0f157cf681d7b (patch)
tree77a97a40d9cc1477eefef80e6b100f21ec2f239d /gdb/gdbtypes.h
parent037311d1df303c91395cdfe07b6ab414de99e420 (diff)
downloadgdb-6244c1196a49a5732ac3667b4df0f157cf681d7b.zip
gdb-6244c1196a49a5732ac3667b4df0f157cf681d7b.tar.gz
gdb-6244c1196a49a5732ac3667b4df0f157cf681d7b.tar.bz2
gdb: make discrete_position return optional
Instead of returning a boolean status and returning the value through a pointer, return an optional that does both jobs. This helps in the following patches, and I think it is an improvement in general. gdb/ChangeLog: * ada-lang.c (ada_value_slice_from_ptr): Adjust. (ada_value_slice): Adjust. (pos_atr): Adjust. * gdbtypes.c (get_discrete_bounds): Adjust. (discrete_position): Return optional. * gdbtypes.h (discrete_position): Return optional. Change-Id: I758dbd8858b296ee472ed39ec35db1dbd624a5ae
Diffstat (limited to 'gdb/gdbtypes.h')
-rw-r--r--gdb/gdbtypes.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index eecd874..e304856 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -46,6 +46,7 @@
#include "hashtab.h"
#include "gdbsupport/array-view.h"
+#include "gdbsupport/gdb_optional.h"
#include "gdbsupport/offset-type.h"
#include "gdbsupport/enum-flags.h"
#include "gdbsupport/underlying.h"
@@ -2477,7 +2478,8 @@ extern int get_discrete_bounds (struct type *, LONGEST *, LONGEST *);
extern bool get_array_bounds (struct type *type, LONGEST *low_bound,
LONGEST *high_bound);
-extern int discrete_position (struct type *type, LONGEST val, LONGEST *pos);
+extern gdb::optional<LONGEST> discrete_position (struct type *type,
+ LONGEST val);
extern int class_types_same_p (const struct type *, const struct type *);