Need alias defs after all.

This commit is contained in:
Bill Currie 2011-01-25 15:42:26 +09:00
parent a648f043de
commit f45919df09
2 changed files with 15 additions and 1 deletions

View file

@ -43,6 +43,7 @@ typedef struct def_s {
struct defspace_s *space;
int offset;
struct def_s *alias;
struct reloc_s *relocs; ///< for relocations
unsigned initialized:1;
@ -71,6 +72,7 @@ typedef enum storage_class_e {
def_t *new_def (const char *name, struct type_s *type,
struct defspace_s *space, storage_class_t storage);
def_t *alias_def (def_t *def, struct type_s *type);
void free_def (def_t *def);
void def_to_ddef (def_t *def, ddef_t *ddef, int aux);

View file

@ -124,10 +124,22 @@ new_def (const char *name, type_t *type, defspace_t *space,
return def;
}
def_t *
alias_def (def_t *def, type_t *type)
{
def_t *alias;
ALLOC (16384, def_t, defs, alias);
alias->offset = def->offset;
alias->type = type;
alias->alias = def;
return alias;
}
void
free_def (def_t *def)
{
if (def->space) {
if (!def->alias && def->space) {
def_t **d;
for (d = &def->space->defs; *d && *d != def; d = &(*d)->next)