Finish constification of varobj interface

This completes the constification of the struct varobj pointers in the
lang_varobj_ops interface partially done in
b09e2c591f. As suggested by Pedro,
varobj_get_path_expr casts away the const to assign the "mutable" struct
member.

gdb/ChangeLog:

	* ada-varobj.c (ada_name_of_child): Constify parent.
	(ada_path_expr_of_child): Same.
	(ada_value_of_child): Same.
	(ada_type_of_child): Same.
	* c-varobj.c (c_is_path_expr_parent): Same.
	(c_describe_child): Same.
	(c_name_of_child): Same.
	(c_value_of_child): Same.
	(c_type_of_child): Same.
	(cplus_number_of_children): Same.
	(cplus_describe_child): Constify var.
	(cplus_name_of_child): Constify parent.
	(cplus_value_of_child): Same.
	(cplus_type_of_child): Same.
	* jv-varobj.c (java_name_of_child): Same.
	(java_value_of_child): Same.
	(java_type_of_child): Same.
	* varobj.c (value_of_child): Same.
	(varobj_default_is_path_expr_parent): Constify var, parent and return
	value.
	(varobj_get_path_expr): Constify var, modify path_expr through
	mutable_var.
	(install_new_value): Constify parent.
	(value_of_child): Constify parent.
	* varobj.h (struct varobj): Constify parent.
	(struct lang_varobj_ops): Constify name_of_child, value_of_child and
	type_of_child.
	(varobj_get_path_expr): Constify var.
	(varobj_get_path_expr_parent): Constify var and return value.
This commit is contained in:
Simon Marchi
2015-02-10 10:46:12 -05:00
parent 834f871cdc
commit c1cc615262
6 changed files with 66 additions and 32 deletions

View File

@@ -146,7 +146,7 @@ c_is_path_expr_parent (const struct varobj *var)
&& TYPE_NAME (type) == NULL
&& TYPE_TAG_NAME (type) == NULL)
{
struct varobj *parent = var->parent;
const struct varobj *parent = var->parent;
while (parent != NULL && CPLUS_FAKE_CHILD (parent))
parent = parent->parent;
@@ -282,7 +282,7 @@ value_struct_element_index (struct value *value, int type_index)
to NULL. */
static void
c_describe_child (struct varobj *parent, int index,
c_describe_child (const struct varobj *parent, int index,
char **cname, struct value **cvalue, struct type **ctype,
char **cfull_expression)
{
@@ -422,7 +422,7 @@ c_describe_child (struct varobj *parent, int index,
}
static char *
c_name_of_child (struct varobj *parent, int index)
c_name_of_child (const struct varobj *parent, int index)
{
char *name;
@@ -441,7 +441,7 @@ c_path_expr_of_child (const struct varobj *child)
}
static struct value *
c_value_of_child (struct varobj *parent, int index)
c_value_of_child (const struct varobj *parent, int index)
{
struct value *value = NULL;
@@ -450,7 +450,7 @@ c_value_of_child (struct varobj *parent, int index)
}
static struct type *
c_type_of_child (struct varobj *parent, int index)
c_type_of_child (const struct varobj *parent, int index)
{
struct type *type = NULL;
@@ -614,7 +614,7 @@ cplus_number_of_children (const struct varobj *var)
/* It is necessary to access a real type (via RTTI). */
if (opts.objectprint)
{
struct varobj *parent = var->parent;
const struct varobj *parent = var->parent;
value = parent->value;
lookup_actual_type = (TYPE_CODE (parent->type) == TYPE_CODE_REF
@@ -697,7 +697,7 @@ match_accessibility (struct type *type, int index, enum accessibility acc)
}
static void
cplus_describe_child (struct varobj *parent, int index,
cplus_describe_child (const struct varobj *parent, int index,
char **cname, struct value **cvalue, struct type **ctype,
char **cfull_expression)
{
@@ -706,7 +706,7 @@ cplus_describe_child (struct varobj *parent, int index,
int was_ptr;
int lookup_actual_type = 0;
char *parent_expression = NULL;
struct varobj *var;
const struct varobj *var;
struct value_print_options opts;
if (cname)
@@ -898,7 +898,7 @@ cplus_describe_child (struct varobj *parent, int index,
}
static char *
cplus_name_of_child (struct varobj *parent, int index)
cplus_name_of_child (const struct varobj *parent, int index)
{
char *name = NULL;
@@ -917,7 +917,7 @@ cplus_path_expr_of_child (const struct varobj *child)
}
static struct value *
cplus_value_of_child (struct varobj *parent, int index)
cplus_value_of_child (const struct varobj *parent, int index)
{
struct value *value = NULL;
@@ -926,7 +926,7 @@ cplus_value_of_child (struct varobj *parent, int index)
}
static struct type *
cplus_type_of_child (struct varobj *parent, int index)
cplus_type_of_child (const struct varobj *parent, int index)
{
struct type *type = NULL;