Matteo Bruni : d3dcompiler: Introduce source_location structure.

Alexandre Julliard julliard at winehq.org
Thu Jul 12 18:00:33 CDT 2012


Module: wine
Branch: master
Commit: 5bcf8de8cfd171bf77b088c79c143048b22c6255
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=5bcf8de8cfd171bf77b088c79c143048b22c6255

Author: Matteo Bruni <mbruni at codeweavers.com>
Date:   Thu Jul 12 16:01:34 2012 +0200

d3dcompiler: Introduce source_location structure.

---

 dlls/d3dcompiler_43/d3dcompiler_private.h |   11 ++++++++---
 dlls/d3dcompiler_43/hlsl.y                |    4 ++--
 dlls/d3dcompiler_43/utils.c               |    2 +-
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/dlls/d3dcompiler_43/d3dcompiler_private.h b/dlls/d3dcompiler_43/d3dcompiler_private.h
index 1286f00..5bb74f0 100644
--- a/dlls/d3dcompiler_43/d3dcompiler_private.h
+++ b/dlls/d3dcompiler_43/d3dcompiler_private.h
@@ -690,6 +690,13 @@ struct hlsl_struct_field
     DWORD modifiers;
 };
 
+struct source_location
+{
+    const char *file;
+    unsigned int line;
+    unsigned int col;
+};
+
 enum hlsl_ir_node_type
 {
     HLSL_IR_VAR = 0,
@@ -705,9 +712,7 @@ struct hlsl_ir_node
     enum hlsl_ir_node_type type;
     struct hlsl_type *data_type;
 
-    const char *source_file;
-    unsigned int line;
-    unsigned int column;
+    struct source_location loc;
 };
 
 #define HLSL_STORAGE_EXTERN          0x00000001
diff --git a/dlls/d3dcompiler_43/hlsl.y b/dlls/d3dcompiler_43/hlsl.y
index 48c43a2..f4afd48 100644
--- a/dlls/d3dcompiler_43/hlsl.y
+++ b/dlls/d3dcompiler_43/hlsl.y
@@ -136,7 +136,7 @@ static BOOL declare_variable(struct hlsl_ir_var *decl, BOOL local)
         struct hlsl_ir_var *old = get_variable(hlsl_ctx.cur_scope, decl->name);
 
         hlsl_message("Line %u: \"%s\" already declared.\n", hlsl_ctx.line_no, decl->name);
-        hlsl_message("Line %u: \"%s\" was previously declared here.\n", old->node.line, decl->name);
+        hlsl_message("Line %u: \"%s\" was previously declared here.\n", old->node.loc.line, decl->name);
         set_parse_status(&hlsl_ctx.status, PARSE_ERR);
         return FALSE;
     }
@@ -616,7 +616,7 @@ declaration:              var_modifiers type variables_def ';'
                                     var->name = v->name;
                                     var->modifiers = $1;
                                     var->semantic = v->semantic;
-                                    var->node.line = hlsl_ctx.line_no;
+                                    var->node.loc.line = hlsl_ctx.line_no;
                                     if (v->initializer)
                                     {
                                         FIXME("Variable with an initializer.\n");
diff --git a/dlls/d3dcompiler_43/utils.c b/dlls/d3dcompiler_43/utils.c
index 2d4eefb..c4dd2e8 100644
--- a/dlls/d3dcompiler_43/utils.c
+++ b/dlls/d3dcompiler_43/utils.c
@@ -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.line = line;
+    decl->node.loc.line = line;
     decl->name = param->name;
     decl->semantic = param->semantic;
     decl->modifiers = param->modifiers;




More information about the wine-cvs mailing list