* gdbtypes.h (struct type): Add field tag_name.

* gdbtypes.c (type_name_no_tag), c-typeprint.c (c_type_print_base):
	Use it.
	* {coff,dwarf,mips,stabs}read.c: Set it.
This commit is contained in:
Jim Kingdon
1993-07-02 02:57:06 +00:00
parent 3fe11d4734
commit b2bebdb0f1
5 changed files with 59 additions and 144 deletions

View File

@@ -472,43 +472,20 @@ smash_to_method_type (type, domain, to_type, args)
TYPE_CODE (type) = TYPE_CODE_METHOD;
}
/* Return a typename for a struct/union/enum type
without the tag qualifier. If the type has a NULL name,
NULL is returned. */
/* Return a typename for a struct/union/enum type without "struct ",
"union ", or "enum ". If the type has a NULL name, return NULL. */
char *
type_name_no_tag (type)
register const struct type *type;
{
register char *name;
if (TYPE_TAG_NAME (type) != NULL)
return TYPE_TAG_NAME (type);
if ((name = TYPE_NAME (type)) != NULL)
{
switch (TYPE_CODE (type))
{
case TYPE_CODE_STRUCT:
if(!strncmp (name, "struct ", 7))
{
name += 7;
}
break;
case TYPE_CODE_UNION:
if(!strncmp (name, "union ", 6))
{
name += 6;
}
break;
case TYPE_CODE_ENUM:
if(!strncmp (name, "enum ", 5))
{
name += 5;
}
break;
default: /* To avoid -Wall warnings */
break;
}
}
return (name);
/* Is there code which expects this to return the name if there is no
tag name? My guess is that this is mainly used for C++ in cases where
the two will always be the same. */
return TYPE_NAME (type);
}
/* Lookup a primitive type named NAME.