Simplify the tag used for anonymous structs etc.

Hopefully two files with the same file name won't have anonymous stucts on
the same line.
This commit is contained in:
Bill Currie 2011-03-04 13:52:32 +09:00
parent e525727a24
commit 2992d66f87

View file

@ -69,13 +69,16 @@ find_tag (ty_type_e ty, symbol_t *tag, type_t *type)
{
const char *tag_name;
symbol_t *sym;
static int tag_num;
if (tag)
if (tag) {
tag_name = va ("tag %s", tag->name);
else
tag_name = va ("tag .%s.%d.%d",
GETSTR (pr.source_file), pr.source_line, tag_num++);
} else {
const char *path = GETSTR (pr.source_file);
const char *file = strrchr (path, '/');
if (!file++)
file = path;
tag_name = va ("tag .%s.%d", file, pr.source_line);
}
sym = symtab_lookup (current_symtab, tag_name);
if (sym) {
if (sym->table == current_symtab && sym->type->ty != ty)