d3dcompiler: Pass the semantic and location parameters to new_func_decl().

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-06-01 17:58:44 -05:00 committed by Alexandre Julliard
parent 5900f00148
commit c7b90bf348
3 changed files with 15 additions and 21 deletions

View File

@ -1096,7 +1096,6 @@ struct hlsl_ir_node *make_assignment(struct hlsl_ir_node *left, enum parse_assig
struct hlsl_ir_node *right) DECLSPEC_HIDDEN;
void push_scope(struct hlsl_parse_ctx *ctx) DECLSPEC_HIDDEN;
BOOL pop_scope(struct hlsl_parse_ctx *ctx) DECLSPEC_HIDDEN;
struct hlsl_ir_function_decl *new_func_decl(struct hlsl_type *return_type, struct list *parameters) DECLSPEC_HIDDEN;
void init_functions_tree(struct wine_rb_tree *funcs) DECLSPEC_HIDDEN;
void add_function_decl(struct wine_rb_tree *funcs, char *name, struct hlsl_ir_function_decl *decl,
BOOL intrinsic) DECLSPEC_HIDDEN;

View File

@ -1248,6 +1248,20 @@ static unsigned int evaluate_array_dimension(struct hlsl_ir_node *node)
}
}
static struct hlsl_ir_function_decl *new_func_decl(struct hlsl_type *return_type,
struct list *parameters, const char *semantic, struct source_location loc)
{
struct hlsl_ir_function_decl *decl;
if (!(decl = d3dcompiler_alloc(sizeof(*decl))))
return NULL;
decl->return_type = return_type;
decl->parameters = parameters;
decl->semantic = semantic;
decl->loc = loc;
return decl;
}
%}
%locations
@ -1648,15 +1662,12 @@ func_prototype: var_modifiers type var_identifier '(' parameters ')' c
FIXME("Unexpected register reservation for a function.\n");
d3dcompiler_free($7.reg_reservation);
}
$$.decl = new_func_decl($2, $5);
if (!$$.decl)
if (!($$.decl = new_func_decl($2, $5, $7.semantic, get_location(&@3))))
{
ERR("Out of memory.\n");
YYABORT;
}
$$.name = $3;
$$.decl->semantic = $7.semantic;
$$.decl->loc = get_location(&@3);
hlsl_ctx.cur_function = $$.decl;
}

View File

@ -1587,22 +1587,6 @@ BOOL pop_scope(struct hlsl_parse_ctx *ctx)
return TRUE;
}
struct hlsl_ir_function_decl *new_func_decl(struct hlsl_type *return_type, struct list *parameters)
{
struct hlsl_ir_function_decl *decl;
decl = d3dcompiler_alloc(sizeof(*decl));
if (!decl)
{
ERR("Out of memory.\n");
return NULL;
}
decl->return_type = return_type;
decl->parameters = parameters;
return decl;
}
static int compare_param_hlsl_types(const struct hlsl_type *t1, const struct hlsl_type *t2)
{
if (t1->type != t2->type)