M include/check.h => include/check.h +2 -0
@@ 127,6 127,8 @@ void mkident(struct context *ctx, struct identifier *out,
void mkstrconst(struct expression *expr, const char *fmt, ...);
+char *gen_typename(const struct type *type);
+
typedef void (*resolvefn)(struct context *,
struct incomplete_declaration *idecl);
M src/check.c => src/check.c +1 -1
@@ 53,7 53,7 @@ mkstrconst(struct expression *expr, const char *fmt, ...)
expr->constant.string.len = n;
}
-static char *
+char *
gen_typename(const struct type *type)
{
size_t sz = 0;
M src/emit.c => src/emit.c +1 -11
@@ 3,6 3,7 @@
#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
+#include "check.h"
#include "emit.h"
#include "qbe.h"
#include "typedef.h"
@@ 34,17 35,6 @@ emit_qtype(const struct qbe_type *type, bool aggr, FILE *out)
}
}
-static char *
-gen_typename(const struct type *type)
-{
- size_t sz = 0;
- char *ptr = NULL;
- FILE *f = open_memstream(&ptr, &sz);
- emit_type(type, f);
- fclose(f);
- return ptr;
-}
-
static void
qemit_type(const struct qbe_def *def, FILE *out)
{