Zebediah Figura : d3dcompiler: Pass a struct source_location to create_loop().

Alexandre Julliard julliard at winehq.org
Fri Mar 6 16:38:42 CST 2020


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Tue Mar  3 20:29:51 2020 -0600

d3dcompiler: Pass a struct source_location to create_loop().

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/hlsl.y | 24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/dlls/d3dcompiler_43/hlsl.y b/dlls/d3dcompiler_43/hlsl.y
index 8f66deb90d..e46bdbade3 100644
--- a/dlls/d3dcompiler_43/hlsl.y
+++ b/dlls/d3dcompiler_43/hlsl.y
@@ -301,7 +301,7 @@ enum loop_type
 };
 
 static struct list *create_loop(enum loop_type type, struct list *init, struct list *cond,
-        struct list *iter, struct list *body, struct source_location *loc)
+        struct list *iter, struct list *body, struct source_location loc)
 {
     struct list *list = NULL;
     struct hlsl_ir_loop *loop = NULL;
@@ -319,7 +319,7 @@ static struct list *create_loop(enum loop_type type, struct list *init, struct l
     if (!loop)
         goto oom;
     loop->node.type = HLSL_IR_LOOP;
-    loop->node.loc = *loc;
+    loop->node.loc = loc;
     list_add_tail(list, &loop->node.entry);
     loop->body = d3dcompiler_alloc(sizeof(*loop->body));
     if (!loop->body)
@@ -1826,33 +1826,23 @@ if_body:                  statement
 
 loop_statement:           KW_WHILE '(' expr ')' statement
                             {
-                                struct source_location loc;
-                                loc = get_location(&@1);
-                                $$ = create_loop(LOOP_WHILE, NULL, $3, NULL, $5, &loc);
+                                $$ = create_loop(LOOP_WHILE, NULL, $3, NULL, $5, get_location(&@1));
                             }
                         | KW_DO statement KW_WHILE '(' expr ')' ';'
                             {
-                                struct source_location loc;
-                                loc = get_location(&@1);
-                                $$ = create_loop(LOOP_DO_WHILE, NULL, $5, NULL, $2, &loc);
+                                $$ = create_loop(LOOP_DO_WHILE, NULL, $5, NULL, $2, get_location(&@1));
                             }
                         | KW_FOR '(' scope_start expr_statement expr_statement expr ')' statement
                             {
-                                struct source_location loc;
-
-                                loc = get_location(&@1);
-                                $$ = create_loop(LOOP_FOR, $4, $5, $6, $8, &loc);
+                                $$ = create_loop(LOOP_FOR, $4, $5, $6, $8, get_location(&@1));
                                 pop_scope(&hlsl_ctx);
                             }
                         | KW_FOR '(' scope_start declaration expr_statement expr ')' statement
                             {
-                                struct source_location loc;
-
-                                loc = get_location(&@1);
                                 if (!$4)
-                                    hlsl_report_message(loc, HLSL_LEVEL_WARNING,
+                                    hlsl_report_message(get_location(&@4), HLSL_LEVEL_WARNING,
                                             "no expressions in for loop initializer");
-                                $$ = create_loop(LOOP_FOR, $4, $5, $6, $8, &loc);
+                                $$ = create_loop(LOOP_FOR, $4, $5, $6, $8, get_location(&@1));
                                 pop_scope(&hlsl_ctx);
                             }
 




More information about the wine-cvs mailing list