From 67607e24d0413828acdfa9bc38f6fbac40b860b9 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Thu, 14 May 2020 13:45:40 -0400 Subject: gdb: add type::code / type::set_code Add the code and set_code methods on code, in order to remove the TYPE_CODE macro. In this patch, the TYPE_CODE macro is changed to use type::code, so all the call sites that are used to set the type code are changed to use type::set_code. The next patch will remove TYPE_CODE completely. gdb/ChangeLog: * gdbtypes.h (struct type) : New methods. (TYPE_CODE): Use type::code. Change all call sites used to set the code to use type::set_code instead. --- gdb/coffread.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'gdb/coffread.c') diff --git a/gdb/coffread.c b/gdb/coffread.c index 7fbdcc4..4b2993f 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -1880,7 +1880,7 @@ decode_base_type (struct coff_symbol *cs, { /* Anonymous structure type. */ type = coff_alloc_type (cs->c_symnum); - TYPE_CODE (type) = TYPE_CODE_STRUCT; + type->set_code (TYPE_CODE_STRUCT); TYPE_NAME (type) = NULL; INIT_CPLUS_SPECIFIC (type); TYPE_LENGTH (type) = 0; @@ -1914,7 +1914,7 @@ decode_base_type (struct coff_symbol *cs, aux->x_sym.x_fcnary.x_fcn.x_endndx.l, objfile); } - TYPE_CODE (type) = TYPE_CODE_UNION; + type->set_code (TYPE_CODE_UNION); return type; case T_ENUM: @@ -1922,7 +1922,7 @@ decode_base_type (struct coff_symbol *cs, { /* Anonymous enum type. */ type = coff_alloc_type (cs->c_symnum); - TYPE_CODE (type) = TYPE_CODE_ENUM; + type->set_code (TYPE_CODE_ENUM); TYPE_NAME (type) = NULL; TYPE_LENGTH (type) = 0; TYPE_FIELDS (type) = 0; @@ -1990,7 +1990,7 @@ coff_read_struct_type (int index, int length, int lastsym, int done = 0; type = coff_alloc_type (index); - TYPE_CODE (type) = TYPE_CODE_STRUCT; + type->set_code (TYPE_CODE_STRUCT); INIT_CPLUS_SPECIFIC (type); TYPE_LENGTH (type) = length; @@ -2121,7 +2121,7 @@ coff_read_enum_type (int index, int length, int lastsym, TYPE_LENGTH (type) = length; else /* Assume ints. */ TYPE_LENGTH (type) = gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT; - TYPE_CODE (type) = TYPE_CODE_ENUM; + type->set_code (TYPE_CODE_ENUM); TYPE_NFIELDS (type) = nsyms; TYPE_FIELDS (type) = (struct field *) TYPE_ALLOC (type, sizeof (struct field) * nsyms); -- cgit v1.1