From 1eb17cda6780476b166b55d0fedc3ad355969e87 Mon Sep 17 00:00:00 2001 From: lemon Date: Fri, 12 Aug 2022 16:43:06 +0200 Subject: selfhosted lexer --- bootstrap/cgen.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'bootstrap/cgen.c') diff --git a/bootstrap/cgen.c b/bootstrap/cgen.c index b0cfd92..7519982 100644 --- a/bootstrap/cgen.c +++ b/bootstrap/cgen.c @@ -541,7 +541,7 @@ liftdecl(struct decl *decl) { static int id; switch (decl->t) { case Dfn: - if (decl->fn.body || (decl->container && !decl->externp)) { + if ((decl->fn.body || (decl->container && !decl->externp)) && !*decl->_cname) { if (decl->container) *decl->_cname = xasprintf("__m%s_%s%d", decl->container->agg.name, decl->fn.name, decl->fn.id); else @@ -710,6 +710,12 @@ defctype(const struct type *ty, void *_) { } break; case TYslice: + if (ty->child->konst) { + const struct type *ty2 = unconstifychild(ty); + defctype(ty2, NULL); + *cname = (char *)ty2->_cname; + return; + } defctype(ty->child, NULL); *cname = xasprintf("__ty%d", id++); pri("typedef struct { %t *ptr; size_t len; } %s;\n", -- cgit v1.2.3