Run find_type() early on enums and structs.

This commit is contained in:
Bill Currie 2011-02-06 20:07:19 +09:00
parent d54a96e68a
commit 6b7a81f5a7
2 changed files with 3 additions and 1 deletions

View File

@ -461,7 +461,7 @@ enum_specifier
; ;
optional_enum_list optional_enum_list
: '{' enum_init enumerator_list optional_comma '}' { $$ = $2; } : enum_list
| /* empty */ { $$ = find_enum ($<symbol>0); } | /* empty */ { $$ = find_enum ($<symbol>0); }
; ;

View File

@ -130,6 +130,7 @@ build_struct (int su, symbol_t *tag, symtab_t *symtab, type_t *type)
} }
sym->sy_type = sy_type; sym->sy_type = sy_type;
sym->type->t.symtab = symtab; sym->type->t.symtab = symtab;
sym->type = find_type (sym->type);
return sym; return sym;
} }
@ -147,6 +148,7 @@ start_enum (symbol_t *sym)
sym = find_enum (0); sym = find_enum (0);
} }
sym->type->t.symtab = new_symtab (current_symtab, stab_local); sym->type->t.symtab = new_symtab (current_symtab, stab_local);
sym->type = find_type (sym->type);
return sym->type->t.symtab; return sym->type->t.symtab;
} }