[PATCH 4/6] d3dcompiler: Pass the semantic and location parameters to new_func_decl().

Zebediah Figura z.figura12 at gmail.com
Mon Jun 1 17:58:44 CDT 2020


Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
 dlls/d3dcompiler_43/d3dcompiler_private.h |  1 -
 dlls/d3dcompiler_43/hlsl.y                | 19 +++++++++++++++----
 dlls/d3dcompiler_43/utils.c               | 16 ----------------
 3 files changed, 15 insertions(+), 21 deletions(-)

diff --git a/dlls/d3dcompiler_43/d3dcompiler_private.h b/dlls/d3dcompiler_43/d3dcompiler_private.h
index 8e96a4fbcac..bc2e43cfff8 100644
--- a/dlls/d3dcompiler_43/d3dcompiler_private.h
+++ b/dlls/d3dcompiler_43/d3dcompiler_private.h
@@ -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;
diff --git a/dlls/d3dcompiler_43/hlsl.y b/dlls/d3dcompiler_43/hlsl.y
index 19e7dd7aeb5..bf0160e369a 100644
--- a/dlls/d3dcompiler_43/hlsl.y
+++ b/dlls/d3dcompiler_43/hlsl.y
@@ -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;
                             }
 
diff --git a/dlls/d3dcompiler_43/utils.c b/dlls/d3dcompiler_43/utils.c
index 440ad491884..4fdda3513f7 100644
--- a/dlls/d3dcompiler_43/utils.c
+++ b/dlls/d3dcompiler_43/utils.c
@@ -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)
-- 
2.26.2




More information about the wine-devel mailing list