mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-20 18:08:24 +08:00
gdb: add type::name / type::set_name
Add the `name` and `set_name` methods on `struct type`, in order to remove the `TYPE_NAME` macro. In this patch, the `TYPE_NAME` macro is changed to use `type::name`, so all the call sites that are used to set the type name are changed to use `type::set_name`. The next patch will remove `TYPE_NAME` completely. gdb/ChangeLog: * gdbtypes.h (struct type) <name, set_name>: New methods. (TYPE_CODE): Use type::name. Change all call sites used to set the name to use type::set_name instead.
This commit is contained in:
@ -1010,10 +1010,10 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
|
||||
(.Fxx or .xxfake or empty) for unnamed struct/union/enums.
|
||||
Alpha cc puts out an sh->iss of zero for those. */
|
||||
if (sh->iss == 0 || name[0] == '.' || name[0] == '\0')
|
||||
TYPE_NAME (t) = NULL;
|
||||
t->set_name (NULL);
|
||||
else
|
||||
TYPE_NAME (t) = obconcat (&mdebugread_objfile->objfile_obstack,
|
||||
name, (char *) NULL);
|
||||
t->set_name (obconcat (&mdebugread_objfile->objfile_obstack,
|
||||
name, (char *) NULL));
|
||||
|
||||
t->set_code (type_code);
|
||||
TYPE_LENGTH (t) = sh->value;
|
||||
@ -1324,7 +1324,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
|
||||
for anything except pointers or functions. */
|
||||
}
|
||||
else
|
||||
TYPE_NAME (SYMBOL_TYPE (s)) = s->linkage_name ();
|
||||
SYMBOL_TYPE (s)->set_name (s->linkage_name ());
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1674,11 +1674,11 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
|
||||
/* Do not set the tag name if it is a compiler generated tag name
|
||||
(.Fxx or .xxfake or empty) for unnamed struct/union/enums. */
|
||||
if (name[0] == '.' || name[0] == '\0')
|
||||
TYPE_NAME (tp) = NULL;
|
||||
tp->set_name (NULL);
|
||||
else if (TYPE_NAME (tp) == NULL
|
||||
|| strcmp (TYPE_NAME (tp), name) != 0)
|
||||
TYPE_NAME (tp)
|
||||
= obstack_strdup (&mdebugread_objfile->objfile_obstack, name);
|
||||
tp->set_name (obstack_strdup (&mdebugread_objfile->objfile_obstack,
|
||||
name));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1713,8 +1713,8 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
|
||||
}
|
||||
if (TYPE_NAME (tp) == NULL
|
||||
|| strcmp (TYPE_NAME (tp), name) != 0)
|
||||
TYPE_NAME (tp)
|
||||
= obstack_strdup (&mdebugread_objfile->objfile_obstack, name);
|
||||
tp->set_name (obstack_strdup (&mdebugread_objfile->objfile_obstack,
|
||||
name));
|
||||
}
|
||||
}
|
||||
if (t->bt == btTypedef)
|
||||
@ -4736,7 +4736,7 @@ new_type (char *name)
|
||||
struct type *t;
|
||||
|
||||
t = alloc_type (mdebugread_objfile);
|
||||
TYPE_NAME (t) = name;
|
||||
t->set_name (name);
|
||||
INIT_CPLUS_SPECIFIC (t);
|
||||
return t;
|
||||
}
|
||||
|
Reference in New Issue
Block a user