remove param "dispp" from ada-lang.c::ada_lookup_struct_elt_type
The function is always called with DISPP set to NULL, so there is no need for this parameter anymore. This patch removes it, and eliminates some dead code associated to that. gdb/ChangeLog: * ada-lang.c (ada_lookup_struct_elt_type): Remove parameter "dispp". Update all callers accordingly. Remove all code blocks handling the case where DISPP is not NULL. Tested on x86_64-linux, no regression.
This commit is contained in:
parent
5fdda9d6a4
commit
988f6b3dc6
2 changed files with 20 additions and 29 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2017-08-25 Joel Brobecker <brobecker@adacore.com>
|
||||||
|
|
||||||
|
* ada-lang.c (ada_lookup_struct_elt_type): Remove parameter "dispp".
|
||||||
|
Update all callers accordingly. Remove all code blocks handling
|
||||||
|
the case where DISPP is not NULL.
|
||||||
|
|
||||||
2017-08-24 Jan Kratochvil <jan.kratochvil@redhat.com>
|
2017-08-24 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
PR symtab/22003
|
PR symtab/22003
|
||||||
|
|
|
@ -152,7 +152,7 @@ static struct symbol *find_old_style_renaming_symbol (const char *,
|
||||||
const struct block *);
|
const struct block *);
|
||||||
|
|
||||||
static struct type *ada_lookup_struct_elt_type (struct type *, const char *,
|
static struct type *ada_lookup_struct_elt_type (struct type *, const char *,
|
||||||
int, int, int *);
|
int, int);
|
||||||
|
|
||||||
static struct value *evaluate_subexp_type (struct expression *, int *);
|
static struct value *evaluate_subexp_type (struct expression *, int *);
|
||||||
|
|
||||||
|
@ -6695,7 +6695,7 @@ ada_is_ignored_field (struct type *type, int field_num)
|
||||||
int
|
int
|
||||||
ada_is_tagged_type (struct type *type, int refok)
|
ada_is_tagged_type (struct type *type, int refok)
|
||||||
{
|
{
|
||||||
return (ada_lookup_struct_elt_type (type, "_tag", refok, 1, NULL) != NULL);
|
return (ada_lookup_struct_elt_type (type, "_tag", refok, 1) != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* True iff TYPE represents the type of X'Tag */
|
/* True iff TYPE represents the type of X'Tag */
|
||||||
|
@ -6721,7 +6721,7 @@ ada_is_tag_type (struct type *type)
|
||||||
struct type *
|
struct type *
|
||||||
ada_tag_type (struct value *val)
|
ada_tag_type (struct value *val)
|
||||||
{
|
{
|
||||||
return ada_lookup_struct_elt_type (value_type (val), "_tag", 1, 0, NULL);
|
return ada_lookup_struct_elt_type (value_type (val), "_tag", 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return 1 if TAG follows the old scheme for Ada tags (used for Ada 95,
|
/* Return 1 if TAG follows the old scheme for Ada tags (used for Ada 95,
|
||||||
|
@ -7066,7 +7066,7 @@ ada_variant_discrim_type (struct type *var_type, struct type *outer_type)
|
||||||
{
|
{
|
||||||
const char *name = ada_variant_discrim_name (var_type);
|
const char *name = ada_variant_discrim_name (var_type);
|
||||||
|
|
||||||
return ada_lookup_struct_elt_type (outer_type, name, 1, 1, NULL);
|
return ada_lookup_struct_elt_type (outer_type, name, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Assuming that TYPE is the type of a variant wrapper, and FIELD_NUM is a
|
/* Assuming that TYPE is the type of a variant wrapper, and FIELD_NUM is a
|
||||||
|
@ -7597,7 +7597,7 @@ type_as_string (struct type *type)
|
||||||
|
|
||||||
static struct type *
|
static struct type *
|
||||||
ada_lookup_struct_elt_type (struct type *type, const char *name, int refok,
|
ada_lookup_struct_elt_type (struct type *type, const char *name, int refok,
|
||||||
int noerr, int *dispp)
|
int noerr)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -7631,30 +7631,20 @@ ada_lookup_struct_elt_type (struct type *type, const char *name, int refok,
|
||||||
{
|
{
|
||||||
const char *t_field_name = TYPE_FIELD_NAME (type, i);
|
const char *t_field_name = TYPE_FIELD_NAME (type, i);
|
||||||
struct type *t;
|
struct type *t;
|
||||||
int disp;
|
|
||||||
|
|
||||||
if (t_field_name == NULL)
|
if (t_field_name == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
else if (field_name_match (t_field_name, name))
|
else if (field_name_match (t_field_name, name))
|
||||||
{
|
|
||||||
if (dispp != NULL)
|
|
||||||
*dispp += TYPE_FIELD_BITPOS (type, i) / 8;
|
|
||||||
return TYPE_FIELD_TYPE (type, i);
|
return TYPE_FIELD_TYPE (type, i);
|
||||||
}
|
|
||||||
|
|
||||||
else if (ada_is_wrapper_field (type, i))
|
else if (ada_is_wrapper_field (type, i))
|
||||||
{
|
{
|
||||||
disp = 0;
|
|
||||||
t = ada_lookup_struct_elt_type (TYPE_FIELD_TYPE (type, i), name,
|
t = ada_lookup_struct_elt_type (TYPE_FIELD_TYPE (type, i), name,
|
||||||
0, 1, &disp);
|
0, 1);
|
||||||
if (t != NULL)
|
if (t != NULL)
|
||||||
{
|
|
||||||
if (dispp != NULL)
|
|
||||||
*dispp += disp + TYPE_FIELD_BITPOS (type, i) / 8;
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
else if (ada_is_variant_part (type, i))
|
else if (ada_is_variant_part (type, i))
|
||||||
{
|
{
|
||||||
|
@ -7669,23 +7659,19 @@ ada_lookup_struct_elt_type (struct type *type, const char *name, int refok,
|
||||||
generates these for unchecked variant types. Revisit
|
generates these for unchecked variant types. Revisit
|
||||||
if the compiler changes this practice. */
|
if the compiler changes this practice. */
|
||||||
const char *v_field_name = TYPE_FIELD_NAME (field_type, j);
|
const char *v_field_name = TYPE_FIELD_NAME (field_type, j);
|
||||||
disp = 0;
|
|
||||||
if (v_field_name != NULL
|
if (v_field_name != NULL
|
||||||
&& field_name_match (v_field_name, name))
|
&& field_name_match (v_field_name, name))
|
||||||
t = TYPE_FIELD_TYPE (field_type, j);
|
t = TYPE_FIELD_TYPE (field_type, j);
|
||||||
else
|
else
|
||||||
t = ada_lookup_struct_elt_type (TYPE_FIELD_TYPE (field_type,
|
t = ada_lookup_struct_elt_type (TYPE_FIELD_TYPE (field_type,
|
||||||
j),
|
j),
|
||||||
name, 0, 1, &disp);
|
name, 0, 1);
|
||||||
|
|
||||||
if (t != NULL)
|
if (t != NULL)
|
||||||
{
|
|
||||||
if (dispp != NULL)
|
|
||||||
*dispp += disp + TYPE_FIELD_BITPOS (type, i) / 8;
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7711,8 +7697,7 @@ is_unchecked_variant (struct type *var_type, struct type *outer_type)
|
||||||
{
|
{
|
||||||
const char *discrim_name = ada_variant_discrim_name (var_type);
|
const char *discrim_name = ada_variant_discrim_name (var_type);
|
||||||
|
|
||||||
return (ada_lookup_struct_elt_type (outer_type, discrim_name, 0, 1, NULL)
|
return (ada_lookup_struct_elt_type (outer_type, discrim_name, 0, 1) == NULL);
|
||||||
== NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -11372,7 +11357,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
|
||||||
{
|
{
|
||||||
type = ada_lookup_struct_elt_type (type1,
|
type = ada_lookup_struct_elt_type (type1,
|
||||||
&exp->elts[pc + 2].string,
|
&exp->elts[pc + 2].string,
|
||||||
1, 1, NULL);
|
1, 1);
|
||||||
|
|
||||||
/* If the field is not found, check if it exists in the
|
/* If the field is not found, check if it exists in the
|
||||||
extension of this object's type. This means that we
|
extension of this object's type. This means that we
|
||||||
|
@ -11392,7 +11377,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
|
||||||
else
|
else
|
||||||
type =
|
type =
|
||||||
ada_lookup_struct_elt_type (type1, &exp->elts[pc + 2].string, 1,
|
ada_lookup_struct_elt_type (type1, &exp->elts[pc + 2].string, 1,
|
||||||
0, NULL);
|
0);
|
||||||
|
|
||||||
return value_zero (ada_aligned_type (type), lval_memory);
|
return value_zero (ada_aligned_type (type), lval_memory);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue