Delete TYPE_CODE_CLASS, it's just an alias of TYPE_CODE_STRUCT.

gdb/ChangeLog:

	* gdbtypes.h (TYPE_CODE_CLASS): Delete.  All uses changed to use
	TYPE_CODE_STRUCT.
This commit is contained in:
Doug Evans 2014-11-06 17:19:06 -08:00
parent 9c1877ead0
commit 4753d33b40
19 changed files with 27 additions and 40 deletions

View File

@ -1353,12 +1353,12 @@ typebase /* Implements (approximately): (type-qualifier)* type-specifier */
expression_context_block); }
| CLASS COMPLETE
{
mark_completion_tag (TYPE_CODE_CLASS, "", 0);
mark_completion_tag (TYPE_CODE_STRUCT, "", 0);
$$ = NULL;
}
| CLASS name COMPLETE
{
mark_completion_tag (TYPE_CODE_CLASS, $2.ptr,
mark_completion_tag (TYPE_CODE_STRUCT, $2.ptr,
$2.length);
$$ = NULL;
}

View File

@ -495,7 +495,7 @@ c_value_print (struct value *val, struct ui_file *stream,
/* Print nothing. */
}
else if (options->objectprint
&& (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CLASS))
&& (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRUCT))
{
int is_ref = TYPE_CODE (type) == TYPE_CODE_REF;
@ -545,7 +545,7 @@ c_value_print (struct value *val, struct ui_file *stream,
if (!value_initialized (val))
fprintf_filtered (stream, " [uninitialized] ");
if (options->objectprint && (TYPE_CODE (type) == TYPE_CODE_CLASS))
if (options->objectprint && (TYPE_CODE (type) == TYPE_CODE_STRUCT))
{
/* Attempt to determine real type of object. */
real_type = value_rtti_type (val, &full, &top, &using_enc);

View File

@ -1297,7 +1297,7 @@ make_symbol_overload_list_adl_namespace (struct type *type,
}
/* Check public base type */
if (TYPE_CODE (type) == TYPE_CODE_CLASS)
if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
for (i = 0; i < TYPE_N_BASECLASSES (type); i++)
{
if (BASETYPE_VIA_PUBLIC (type, i))
@ -1463,7 +1463,7 @@ cp_lookup_rtti_type (const char *name, struct block *block)
switch (TYPE_CODE (rtti_type))
{
case TYPE_CODE_CLASS:
case TYPE_CODE_STRUCT:
break;
case TYPE_CODE_NAMESPACE:
/* chastain/2003-11-26: the symbol tables often contain fake

View File

@ -605,10 +605,10 @@ BasicType:
{ $$ = lookup_struct (copy_name ($2),
expression_context_block); }
| CLASS_KEYWORD COMPLETE
{ mark_completion_tag (TYPE_CODE_CLASS, "", 0);
{ mark_completion_tag (TYPE_CODE_STRUCT, "", 0);
$$ = NULL; }
| CLASS_KEYWORD IdentifierExp COMPLETE
{ mark_completion_tag (TYPE_CODE_CLASS, $2.ptr, $2.length);
{ mark_completion_tag (TYPE_CODE_STRUCT, $2.ptr, $2.length);
$$ = NULL; }
| STRUCT_KEYWORD IdentifierExp
{ $$ = lookup_struct (copy_name ($2),

View File

@ -12965,7 +12965,7 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
}
else
{
TYPE_CODE (type) = TYPE_CODE_CLASS;
TYPE_CODE (type) = TYPE_CODE_STRUCT;
}
if (cu->language == language_cplus && die->tag == DW_TAG_class_type)

View File

@ -1870,7 +1870,7 @@ evaluate_subexp_standard (struct type *expect_type,
get_user_print_options (&opts);
if (opts.objectprint && TYPE_TARGET_TYPE(type)
&& (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CLASS))
&& (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRUCT))
{
real_type = value_rtti_indirect_type (arg1, &full, &top,
&using_enc);

View File

@ -3414,7 +3414,6 @@ rank_one_type (struct type *parm, struct type *arg, struct value *value)
}
break;
case TYPE_CODE_STRUCT:
/* currently same as TYPE_CODE_CLASS. */
switch (TYPE_CODE (arg))
{
case TYPE_CODE_STRUCT:

View File

@ -184,15 +184,6 @@ enum type_code
TYPE_CODE_XMETHOD
};
/* * For now allow source to use TYPE_CODE_CLASS for C++ classes, as
an alias for TYPE_CODE_STRUCT. This is for DWARF, which has a
distinct "class" attribute. Perhaps we should actually have a
separate TYPE_CODE so that we can print "class" or "struct"
depending on what the debug info said. It's not clear we should
bother. */
#define TYPE_CODE_CLASS TYPE_CODE_STRUCT
/* * Some constants representing each bit field in the main_type. See
the bit-field-specific macros, below, for documentation of each
constant in this enum. These enum values are only used with

View File

@ -206,7 +206,7 @@ gnuv2_value_rtti_type (struct value *v, int *full, int *top, int *using_enc)
known_type = value_type (v);
CHECK_TYPEDEF (known_type);
/* RTTI works only or class objects. */
if (TYPE_CODE (known_type) != TYPE_CODE_CLASS)
if (TYPE_CODE (known_type) != TYPE_CODE_STRUCT)
return NULL;
/* Plan on this changing in the future as i get around to setting

View File

@ -288,7 +288,7 @@ gnuv3_rtti_type (struct value *value,
char *atsign;
/* We only have RTTI for class objects. */
if (TYPE_CODE (values_type) != TYPE_CODE_CLASS)
if (TYPE_CODE (values_type) != TYPE_CODE_STRUCT)
return NULL;
/* Java doesn't have RTTI following the C++ ABI. */
@ -406,7 +406,7 @@ gnuv3_virtual_fn_field (struct value **value_p,
struct gdbarch *gdbarch;
/* Some simple sanity checks. */
if (TYPE_CODE (values_type) != TYPE_CODE_CLASS)
if (TYPE_CODE (values_type) != TYPE_CODE_STRUCT)
error (_("Only classes can have virtual functions."));
/* Determine architecture. */
@ -1101,7 +1101,7 @@ gnuv3_get_typeid (struct value *value)
/* We check for lval_memory because in the "typeid (type-id)" case,
the type is passed via a not_lval value object. */
if (TYPE_CODE (type) == TYPE_CODE_CLASS
if (TYPE_CODE (type) == TYPE_CODE_STRUCT
&& value_lval_const (value) == lval_memory
&& gnuv3_dynamic_class (type))
{
@ -1277,7 +1277,6 @@ gnuv3_pass_by_reference (struct type *type)
/* We're only interested in things that can have methods. */
if (TYPE_CODE (type) != TYPE_CODE_STRUCT
&& TYPE_CODE (type) != TYPE_CODE_CLASS
&& TYPE_CODE (type) != TYPE_CODE_UNION)
return 0;

View File

@ -1199,7 +1199,7 @@ gdbscm_field_baseclass_p (SCM self)
struct field *field = tyscm_field_smob_to_field (f_smob);
struct type *type = tyscm_field_smob_containing_type (f_smob);
if (TYPE_CODE (type) == TYPE_CODE_CLASS)
if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
return scm_from_bool (f_smob->field_num < TYPE_N_BASECLASSES (type));
return SCM_BOOL_F;
}

View File

@ -565,7 +565,7 @@ gdbscm_value_dynamic_type (SCM self)
if (((TYPE_CODE (type) == TYPE_CODE_PTR)
|| (TYPE_CODE (type) == TYPE_CODE_REF))
&& (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CLASS))
&& (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRUCT))
{
struct value *target;
int was_pointer = TYPE_CODE (type) == TYPE_CODE_PTR;
@ -584,7 +584,7 @@ gdbscm_value_dynamic_type (SCM self)
type = lookup_reference_type (type);
}
}
else if (TYPE_CODE (type) == TYPE_CODE_CLASS)
else if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
type = value_rtti_type (value, NULL, NULL, NULL);
else
{

View File

@ -410,8 +410,8 @@ exp : type '(' exp ')' %prec UNARY
{
/* Allow automatic dereference of classes. */
if ((TYPE_CODE (current_type) == TYPE_CODE_PTR)
&& (TYPE_CODE (TYPE_TARGET_TYPE (current_type)) == TYPE_CODE_CLASS)
&& (TYPE_CODE ($1) == TYPE_CODE_CLASS))
&& (TYPE_CODE (TYPE_TARGET_TYPE (current_type)) == TYPE_CODE_STRUCT)
&& (TYPE_CODE ($1) == TYPE_CODE_STRUCT))
write_exp_elt_opcode (pstate, UNOP_IND);
}
write_exp_elt_opcode (pstate, UNOP_CAST);

View File

@ -583,7 +583,6 @@ mark_completion_tag (enum type_code tag, const char *ptr, int length)
&& expout_last_struct == -1);
gdb_assert (tag == TYPE_CODE_UNION
|| tag == TYPE_CODE_STRUCT
|| tag == TYPE_CODE_CLASS
|| tag == TYPE_CODE_ENUM);
expout_tag_completion_type = tag;
expout_completion_name = xmalloc (length + 1);

View File

@ -232,7 +232,7 @@ convert_field (struct type *type, int field)
goto failarg;
Py_DECREF (arg);
if (TYPE_CODE (type) == TYPE_CODE_CLASS)
if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
arg = field < TYPE_N_BASECLASSES (type) ? Py_True : Py_False;
else
arg = Py_False;

View File

@ -302,7 +302,7 @@ valpy_get_dynamic_type (PyObject *self, void *closure)
if (((TYPE_CODE (type) == TYPE_CODE_PTR)
|| (TYPE_CODE (type) == TYPE_CODE_REF))
&& (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CLASS))
&& (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRUCT))
{
struct value *target;
int was_pointer = TYPE_CODE (type) == TYPE_CODE_PTR;
@ -321,7 +321,7 @@ valpy_get_dynamic_type (PyObject *self, void *closure)
type = lookup_reference_type (type);
}
}
else if (TYPE_CODE (type) == TYPE_CODE_CLASS)
else if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
type = value_rtti_type (val, NULL, NULL, NULL);
else
{

View File

@ -4720,7 +4720,6 @@ make_symbol_completion_type (const char *text, const char *word,
{
gdb_assert (code == TYPE_CODE_UNION
|| code == TYPE_CODE_STRUCT
|| code == TYPE_CODE_CLASS
|| code == TYPE_CODE_ENUM);
return current_language->la_make_symbol_completion_list (text, word, code);
}

View File

@ -461,9 +461,9 @@ whatis_exp (char *exp, int show)
{
if (((TYPE_CODE (type) == TYPE_CODE_PTR)
|| (TYPE_CODE (type) == TYPE_CODE_REF))
&& (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CLASS))
&& (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRUCT))
real_type = value_rtti_indirect_type (val, &full, &top, &using_enc);
else if (TYPE_CODE (type) == TYPE_CODE_CLASS)
else if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
real_type = value_rtti_type (val, &full, &top, &using_enc);
}

View File

@ -735,7 +735,7 @@ value_dynamic_cast (struct type *type, struct value *arg)
&& TYPE_CODE (resolved_type) != TYPE_CODE_REF)
error (_("Argument to dynamic_cast must be a pointer or reference type"));
if (TYPE_CODE (TYPE_TARGET_TYPE (resolved_type)) != TYPE_CODE_VOID
&& TYPE_CODE (TYPE_TARGET_TYPE (resolved_type)) != TYPE_CODE_CLASS)
&& TYPE_CODE (TYPE_TARGET_TYPE (resolved_type)) != TYPE_CODE_STRUCT)
error (_("Argument to dynamic_cast must be pointer to class or `void *'"));
class_type = check_typedef (TYPE_TARGET_TYPE (resolved_type));
@ -748,7 +748,7 @@ value_dynamic_cast (struct type *type, struct value *arg)
if (TYPE_CODE (arg_type) == TYPE_CODE_PTR)
{
arg_type = check_typedef (TYPE_TARGET_TYPE (arg_type));
if (TYPE_CODE (arg_type) != TYPE_CODE_CLASS)
if (TYPE_CODE (arg_type) != TYPE_CODE_STRUCT)
error (_("Argument to dynamic_cast does "
"not have pointer to class type"));
}
@ -761,7 +761,7 @@ value_dynamic_cast (struct type *type, struct value *arg)
}
else
{
if (TYPE_CODE (arg_type) != TYPE_CODE_CLASS)
if (TYPE_CODE (arg_type) != TYPE_CODE_STRUCT)
error (_("Argument to dynamic_cast does not have class type"));
}