[PATCH 2/5] d3dcompiler: Pass the complete location to add_func_parameter().

Matteo Bruni mbruni at codeweavers.com
Mon Jul 16 13:39:20 CDT 2012


---
 dlls/d3dcompiler_43/d3dcompiler_private.h |    3 ++-
 dlls/d3dcompiler_43/hlsl.y                |   15 ++++++++++-----
 dlls/d3dcompiler_43/utils.c               |    4 ++--
 3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/dlls/d3dcompiler_43/d3dcompiler_private.h b/dlls/d3dcompiler_43/d3dcompiler_private.h
index 194ed25..21ed57e 100644
--- a/dlls/d3dcompiler_43/d3dcompiler_private.h
+++ b/dlls/d3dcompiler_43/d3dcompiler_private.h
@@ -882,7 +882,8 @@ static inline struct hlsl_ir_constructor *constructor_from_node(const struct hls
 BOOL add_declaration(struct hlsl_scope *scope, struct hlsl_ir_var *decl, BOOL local_var) DECLSPEC_HIDDEN;
 struct hlsl_ir_var *get_variable(struct hlsl_scope *scope, const char *name) DECLSPEC_HIDDEN;
 void free_declaration(struct hlsl_ir_var *decl) DECLSPEC_HIDDEN;
-BOOL add_func_parameter(struct list *list, struct parse_parameter *param, unsigned int line) DECLSPEC_HIDDEN;
+BOOL add_func_parameter(struct list *list, struct parse_parameter *param,
+        const struct source_location *loc) DECLSPEC_HIDDEN;
 struct hlsl_type *new_hlsl_type(const char *name, enum hlsl_type_class type_class,
         enum hlsl_base_type base_type, unsigned dimx, unsigned dimy) DECLSPEC_HIDDEN;
 struct hlsl_type *new_array_type(struct hlsl_type *basic_type, unsigned int array_size) DECLSPEC_HIDDEN;
diff --git a/dlls/d3dcompiler_43/hlsl.y b/dlls/d3dcompiler_43/hlsl.y
index f7f62fe..b421402 100644
--- a/dlls/d3dcompiler_43/hlsl.y
+++ b/dlls/d3dcompiler_43/hlsl.y
@@ -430,9 +430,12 @@ parameters:               scope_start
 
 param_list:               parameter
                             {
+                                struct source_location loc;
+
                                 $$ = d3dcompiler_alloc(sizeof(*$$));
                                 list_init($$);
-                                if (!add_func_parameter($$, &$1, hlsl_ctx.line_no))
+                                set_location(&loc, &@1);
+                                if (!add_func_parameter($$, &$1, &loc))
                                 {
                                     ERR("Error adding function parameter %s.\n", $1.name);
                                     set_parse_status(&hlsl_ctx.status, PARSE_ERR);
@@ -441,12 +444,14 @@ param_list:               parameter
                             }
                         | param_list ',' parameter
                             {
+                                struct source_location loc;
+
                                 $$ = $1;
-                                if (!add_func_parameter($$, &$3, hlsl_ctx.line_no))
+                                set_location(&loc, &@3);
+                                if (!add_func_parameter($$, &$3, &loc))
                                 {
-                                    hlsl_message("Line %u: duplicate parameter %s.\n",
-                                            hlsl_ctx.line_no, $3.name);
-                                    set_parse_status(&hlsl_ctx.status, PARSE_ERR);
+                                    hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR,
+                                            "duplicate parameter %s", $3.name);
                                     return 1;
                                 }
                             }
diff --git a/dlls/d3dcompiler_43/utils.c b/dlls/d3dcompiler_43/utils.c
index c4dd2e8..ce95bb5 100644
--- a/dlls/d3dcompiler_43/utils.c
+++ b/dlls/d3dcompiler_43/utils.c
@@ -805,7 +805,7 @@ void free_declaration(struct hlsl_ir_var *decl)
     d3dcompiler_free(decl);
 }
 
-BOOL add_func_parameter(struct list *list, struct parse_parameter *param, unsigned int line)
+BOOL add_func_parameter(struct list *list, struct parse_parameter *param, const struct source_location *loc)
 {
     struct hlsl_ir_var *decl = d3dcompiler_alloc(sizeof(*decl));
 
@@ -816,7 +816,7 @@ BOOL add_func_parameter(struct list *list, struct parse_parameter *param, unsign
     }
     decl->node.type = HLSL_IR_VAR;
     decl->node.data_type = param->type;
-    decl->node.loc.line = line;
+    decl->node.loc = *loc;
     decl->name = param->name;
     decl->semantic = param->semantic;
     decl->modifiers = param->modifiers;
-- 
1.7.8.6




More information about the wine-patches mailing list