harec

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 0ef535b1fb46ac588b778c494f4c28e36218147f
parent 9aaf10d1ac82911b2154d8bf033d800ac3e19786
Author: Drew DeVault <sir@cmpwn.com>
Date:   Mon, 28 Dec 2020 15:36:22 -0500

gen: experimental support for aggregate parameters

Diffstat:
Msrc/gen.c | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/gen.c b/src/gen.c @@ -694,7 +694,12 @@ gen_function_decl(struct gen_context *ctx, const struct declaration *decl) param->type = qtype_for_type(ctx, obj->type, true); if (type_is_aggregate(obj->type)) { - assert(0); // TODO + struct gen_binding *binding = + xcalloc(1, sizeof(struct gen_binding)); + binding->name = strdup(param->name); + binding->object = obj; + binding->next = ctx->bindings; + ctx->bindings = binding; } else { struct qbe_value val; binding_alloc(ctx, obj, &val, "param.%d"); @@ -704,7 +709,6 @@ gen_function_decl(struct gen_context *ctx, const struct declaration *decl) .name = param->name, }; gen_store(ctx, &val, &src); - free(obj->ident.name); } obj = obj->next;