/* Internal type definitions for GDB.
- Copyright (C) 1992-2018 Free Software Foundation, Inc.
+ Copyright (C) 1992-2019 Free Software Foundation, Inc.
Contributed by Cygnus Support, using pieces from other GDB modules.
*/
#include "hashtab.h"
+#include "common/array-view.h"
#include "common/offset-type.h"
#include "common/enum-flags.h"
#include "common/underlying.h"
/* * Some bits for the type's instance_flags word. See the macros
below for documentation on each bit. */
-enum type_instance_flag_value
+enum type_instance_flag_value : unsigned
{
TYPE_INSTANCE_FLAG_CONST = (1 << 0),
TYPE_INSTANCE_FLAG_VOLATILE = (1 << 1),
short subrank;
};
-/* * Struct used for ranking a function for overload resolution. */
+/* * Used for ranking a function for overload resolution. */
-struct badness_vector
- {
- int length;
- struct rank *rank;
- };
+typedef std::vector<rank> badness_vector;
/* * GNAT Ada-specific information for various Ada types. */
extern const char *type_name_or_error (struct type *type);
+struct struct_elt
+{
+ /* The field of the element, or NULL if no element was found. */
+ struct field *field;
+
+ /* The bit offset of the element in the parent structure. */
+ LONGEST offset;
+};
+
+/* Given a type TYPE, lookup the field and offset of the component named
+ NAME.
+
+ TYPE can be either a struct or union, or a pointer or reference to
+ a struct or union. If it is a pointer or reference, its target
+ type is automatically used. Thus '.' and '->' are interchangable,
+ as specified for the definitions of the expression element types
+ STRUCTOP_STRUCT and STRUCTOP_PTR.
+
+ If NOERR is nonzero, the returned structure will have field set to
+ NULL if there is no component named NAME.
+
+ If the component NAME is a field in an anonymous substructure of
+ TYPE, the returned offset is a "global" offset relative to TYPE
+ rather than an offset within the substructure. */
+
+extern struct_elt lookup_struct_elt (struct type *, const char *, int);
+
+/* Given a type TYPE, lookup the type of the component named NAME.
+
+ TYPE can be either a struct or union, or a pointer or reference to
+ a struct or union. If it is a pointer or reference, its target
+ type is automatically used. Thus '.' and '->' are interchangable,
+ as specified for the definitions of the expression element types
+ STRUCTOP_STRUCT and STRUCTOP_PTR.
+
+ If NOERR is nonzero, return NULL if there is no component named
+ NAME. */
+
extern struct type *lookup_struct_elt_type (struct type *, const char *, int);
extern struct type *make_pointer_type (struct type *, struct type **);
/* Overload resolution */
-#define LENGTH_MATCH(bv) ((bv)->rank[0])
-
/* * Badness if parameter list length doesn't match arg list length. */
extern const struct rank LENGTH_MISMATCH_BADNESS;
extern struct rank sum_ranks (struct rank a, struct rank b);
extern int compare_ranks (struct rank a, struct rank b);
-extern int compare_badness (struct badness_vector *, struct badness_vector *);
+extern int compare_badness (const badness_vector &,
+ const badness_vector &);
-extern struct badness_vector *rank_function (struct type **, int,
- struct value **, int);
+extern badness_vector rank_function (gdb::array_view<type *> parms,
+ gdb::array_view<value *> args);
extern struct rank rank_one_type (struct type *, struct type *,
struct value *);