Maintain a symbol table for entity fields.

This commit is contained in:
Bill Currie 2011-03-06 15:38:19 +09:00
parent c29e0250e4
commit fe3d228658
3 changed files with 7 additions and 0 deletions

View file

@ -72,6 +72,7 @@ typedef struct pr_info_s {
struct defspace_s *type_data; ///< encoded type information.
struct symtab_s *symtab;
struct symtab_s *entity_fields;
srcline_t *srcline_stack;
string_t source_file;

View file

@ -288,8 +288,12 @@ init_field_def (def_t *def)
{
type_t *type = def->type->t.fldptr.type;
def_t *field_def;
symbol_t *field_sym;
field_def = new_def (def->name, type, pr.entity_data, st_global);
field_sym = new_symbol_type (def->name, type);
field_sym->s.def = field_def;
symtab_addsymbol (pr.entity_fields, field_sym);
D_INT (def) = field_def->offset;
reloc_def_field (def, field_def);
def->constant = 1;

View file

@ -159,6 +159,8 @@ InitData (void)
pr.symtab->space = pr.near_data;
pr.entity_data = defspace_new ();
pr.entity_fields = new_symtab (0, stab_global);
pr.entity_fields->space = pr.entity_data;;
numglobaldefs = 1;
numfielddefs = 1;