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

Alexandre Julliard julliard at winehq.org
Wed Jun 3 16:40:59 CDT 2020


Module: wine
Branch: master
Commit: c7b90bf3483ef4d926c0c3a5fdc6d7999d1e3302
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=c7b90bf3483ef4d926c0c3a5fdc6d7999d1e3302

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Mon Jun  1 17:58:44 2020 -0500

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

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 8e96a4fbca..bc2e43cfff 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 19e7dd7aeb..bf0160e369 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 440ad49188..4fdda3513f 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)




More information about the wine-cvs mailing list