Fix overzealous type merging.

Use the type name instead of the symbol table for comparing
struct/union/enum types.
This commit is contained in:
Bill Currie 2011-02-07 20:48:01 +09:00
parent 265a244ba2
commit 3c64ae7b66
3 changed files with 11 additions and 9 deletions

View file

@ -81,15 +81,16 @@ type_t type_Method = { ev_invalid, "Method" };
type_t type_Super = { ev_invalid, "Super" };
type_t type_method_description = { ev_invalid, "obj_method_description",
ty_struct };
type_t type_category;
type_t type_ivar;
type_t type_module;
type_t type_category = { ev_invalid, "category", ty_struct};
type_t type_ivar = { ev_invalid, "ivar", ty_struct};
type_t type_module = { ev_invalid, "module", ty_struct};
type_t type_object = {ev_invalid, "object", ty_class};
type_t type_id = { ev_pointer, "id", ty_none, {{&type_object}}};
type_t type_Class = { ev_invalid, "Class", ty_class};
type_t type_ClassPtr = { ev_pointer, 0, ty_none, {{&type_Class}}};
type_t type_Protocol = { ev_invalid, "Protocol", ty_class};
class_t class_object = {1, "id"};
class_t class_Class = {1, "Class"};
class_t class_Protocol = {1, "Protocol"};

View file

@ -83,10 +83,10 @@ find_tag (ty_type_e ty, symbol_t *tag, type_t *type)
return sym;
}
sym = new_symbol (tag_name);
if (!type) {
if (!type)
type = new_type ();
type->name = sym->name + 4;
}
if (!type->name)
type->name = sym->name;
sym->type = type;
sym->type->type = ev_invalid;
sym->type->ty = ty;
@ -224,6 +224,7 @@ emit_structure (const char *name, int su, struct_def_t *defs, type_t *type,
def_t field_def;
if (!type) {
memset (&new, 0, sizeof (new));
type = &new;
make_structure (0, su, defs, type);
}

View file

@ -81,8 +81,8 @@ type_t *type_default;
// these will be built up further
type_t type_va_list = { ev_invalid, "@va_list", ty_struct };
type_t type_param;
type_t type_zero;
type_t type_param = { ev_invalid, "@param", ty_struct };
type_t type_zero = { ev_invalid, "@zero", ty_struct };
type_t type_floatfield = { ev_field, ".float", ty_none, {{&type_float}} };
@ -225,7 +225,7 @@ types_same (type_t *a, type_t *b)
case ty_struct:
case ty_union:
case ty_enum:
if (a->t.symtab != b->t.symtab)
if (strcmp (a->name, b->name))
return 0;
return 1;
case ty_array: