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/dwarf2/read.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'gdb/dwarf2') diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 27bf40a..4809202 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -9325,7 +9325,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile) /* Smash this type to be a structure type. We have to do this because the type has already been recorded. */ - TYPE_CODE (type) = TYPE_CODE_STRUCT; + type->set_code (TYPE_CODE_STRUCT); TYPE_NFIELDS (type) = 3; /* Save the field we care about. */ struct field saved_field = TYPE_FIELD (type, 0); @@ -9368,7 +9368,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile) { /* Smash this type to be a structure type. We have to do this because the type has already been recorded. */ - TYPE_CODE (type) = TYPE_CODE_STRUCT; + type->set_code (TYPE_CODE_STRUCT); struct type *field_type = TYPE_FIELD_TYPE (type, 0); const char *variant_name @@ -9415,7 +9415,7 @@ quirk_rust_enum (struct type *type, struct objfile *objfile) /* Smash this type to be a structure type. We have to do this because the type has already been recorded. */ - TYPE_CODE (type) = TYPE_CODE_STRUCT; + type->set_code (TYPE_CODE_STRUCT); /* Make space for the discriminant field. */ struct field *disr_field = &TYPE_FIELD (disr_type, 0); @@ -15369,15 +15369,15 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu) if (die->tag == DW_TAG_structure_type) { - TYPE_CODE (type) = TYPE_CODE_STRUCT; + type->set_code (TYPE_CODE_STRUCT); } else if (die->tag == DW_TAG_union_type) { - TYPE_CODE (type) = TYPE_CODE_UNION; + type->set_code (TYPE_CODE_UNION); } else { - TYPE_CODE (type) = TYPE_CODE_STRUCT; + type->set_code (TYPE_CODE_STRUCT); } if (cu->language == language_cplus && die->tag == DW_TAG_class_type) @@ -15937,7 +15937,7 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu) type = alloc_type (objfile); - TYPE_CODE (type) = TYPE_CODE_ENUM; + type->set_code (TYPE_CODE_ENUM); name = dwarf2_full_name (NULL, die, cu); if (name != NULL) TYPE_NAME (type) = name; -- cgit v1.1