mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-06-04 02:20:53 +00:00
[qfcc] Clone metafunc for generated generic symbols
Simply referencing the original metafunc resulted in only the first variant getting a def. Now my little test generates defs for all called variants of a generic function. However, I'm still not sure this is quite the direction I want to go with making calls to generic functions, but I still need to figure out defining them. I think making progress with the glsl front-end will help.
This commit is contained in:
parent
4f5fcbd819
commit
bbb90ce27a
1 changed files with 11 additions and 2 deletions
|
@ -515,6 +515,14 @@ check_params (param_t *params)
|
|||
return params;
|
||||
}
|
||||
|
||||
static metafunc_t *
|
||||
new_metafunc (void)
|
||||
{
|
||||
metafunc_t *metafunc;
|
||||
ALLOC (1024, metafunc_t, metafuncs, metafunc);
|
||||
return metafunc;
|
||||
}
|
||||
|
||||
static metafunc_t *
|
||||
get_function (const char *name, const type_t *type, specifier_t spec)
|
||||
{
|
||||
|
@ -551,7 +559,7 @@ get_function (const char *name, const type_t *type, specifier_t spec)
|
|||
overload = true;
|
||||
}
|
||||
|
||||
ALLOC (1024, metafunc_t, metafuncs, func);
|
||||
func = new_metafunc ();
|
||||
*func = (metafunc_t) {
|
||||
.name = save_string (name),
|
||||
.full_name = full_name,
|
||||
|
@ -785,7 +793,8 @@ find_generic_function (const expr_t *fexpr, genfunc_t **genfuncs,
|
|||
sym->sy_type = sy_func;
|
||||
sym->type = type;
|
||||
sym->params = params;
|
||||
sym->metafunc = fsym->metafunc;
|
||||
sym->metafunc = new_metafunc ();
|
||||
*sym->metafunc = *fsym->metafunc;
|
||||
symtab_addsymbol (fsym->table, sym);
|
||||
}
|
||||
return new_symbol_expr (sym);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue