aboutsummaryrefslogtreecommitdiff
path: root/qbe.c
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2024-04-12 00:46:22 -0700
committerMichael Forney <mforney@mforney.org>2024-04-12 00:46:22 -0700
commit7d6efdd8626fd3a654a8f231fc1ddc481352af6a (patch)
treeedc6352a07ffd5e23af2f9ffcbc4c0d0be6c38e9 /qbe.c
parentaefce92bd54033c49ba007fde4904dfc6ca740ff (diff)
decl: Add name field to decl struct
Diffstat (limited to 'qbe.c')
-rw-r--r--qbe.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/qbe.c b/qbe.c
index 8a7010a..f4c97db 100644
--- a/qbe.c
+++ b/qbe.c
@@ -493,7 +493,7 @@ mkfunc(struct decl *decl, char *name, struct type *t, struct scope *s)
functemp(f, p->value);
if(!p->name)
continue;
- d = mkdecl(DECLOBJECT, p->type, p->qual, LINKNONE);
+ d = mkdecl(p->name, DECLOBJECT, p->type, p->qual, LINKNONE);
if (p->type->value) {
d->value = p->value;
} else {
@@ -501,13 +501,13 @@ mkfunc(struct decl *decl, char *name, struct type *t, struct scope *s)
funcalloc(f, d);
funcstore(f, p->type, QUALNONE, (struct lvalue){d->value}, v);
}
- scopeputdecl(s, p->name, d);
+ scopeputdecl(s, d);
}
t = mkarraytype(&typechar, QUALCONST, strlen(name) + 1);
- d = mkdecl(DECLOBJECT, t, QUALNONE, LINKNONE);
- d->value = mkglobal("__func__", true);
- scopeputdecl(s, "__func__", d);
+ d = mkdecl("__func__", DECLOBJECT, t, QUALNONE, LINKNONE);
+ d->value = mkglobal(d->name, true);
+ scopeputdecl(s, d);
f->namedecl = d;
funclabel(f, mkblock("body"));
@@ -639,7 +639,7 @@ funclval(struct func *f, struct expr *e)
lval.addr = d->value;
break;
case EXPRCOMPOUND:
- d = mkdecl(DECLOBJECT, e->type, e->qual, LINKNONE);
+ d = mkdecl(NULL, DECLOBJECT, e->type, e->qual, LINKNONE);
funcinit(f, d, e->u.compound.init, true);
lval.addr = d->value;
break;