Mesa (master): glsl: Don't hide the type of struct_declaration_list.
Eric Anholt
anholt at kemper.freedesktop.org
Mon Jul 9 19:45:09 UTC 2012
Module: Mesa
Branch: master
Commit: 912a429bc529a017a426f06631b31da1c0eaa3ae
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=912a429bc529a017a426f06631b31da1c0eaa3ae
Author: Eric Anholt <eric at anholt.net>
Date: Thu Apr 26 10:16:52 2012 -0700
glsl: Don't hide the type of struct_declaration_list.
I've been trying to derive from this for UBO support, and the slightly
obfuscated types were putting me over the edge.
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/glsl/ast.h | 6 +++++-
src/glsl/glsl_parser.yy | 6 +++---
src/glsl/glsl_parser_extras.cpp | 2 +-
3 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/glsl/ast.h b/src/glsl/ast.h
index b096c83..7538b58 100644
--- a/src/glsl/ast.h
+++ b/src/glsl/ast.h
@@ -417,15 +417,19 @@ struct ast_type_qualifier {
const char *interpolation_string() const;
};
+class ast_declarator_list;
+
class ast_struct_specifier : public ast_node {
public:
- ast_struct_specifier(const char *identifier, ast_node *declarator_list);
+ ast_struct_specifier(const char *identifier,
+ ast_declarator_list *declarator_list);
virtual void print(void) const;
virtual ir_rvalue *hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state);
const char *name;
+ /* List of ast_declarator_list * */
exec_list declarations;
};
diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
index 531d257..8759863 100644
--- a/src/glsl/glsl_parser.yy
+++ b/src/glsl/glsl_parser.yy
@@ -214,7 +214,7 @@ static void yyerror(YYLTYPE *loc, _mesa_glsl_parse_state *st, const char *msg)
%type <node> declaration_statement
%type <node> jump_statement
%type <struct_specifier> struct_specifier
-%type <node> struct_declaration_list
+%type <declarator_list> struct_declaration_list
%type <declarator_list> struct_declaration
%type <declaration> struct_declarator
%type <declaration> struct_declarator_list
@@ -1479,12 +1479,12 @@ struct_specifier:
struct_declaration_list:
struct_declaration
{
- $$ = (ast_node *) $1;
+ $$ = $1;
$1->link.self_link();
}
| struct_declaration_list struct_declaration
{
- $$ = (ast_node *) $1;
+ $$ = $1;
$$->link.insert_before(& $2->link);
}
;
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index c19b6f9..d9ee406 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -1003,7 +1003,7 @@ ast_struct_specifier::print(void) const
ast_struct_specifier::ast_struct_specifier(const char *identifier,
- ast_node *declarator_list)
+ ast_declarator_list *declarator_list)
{
if (identifier == NULL) {
static unsigned anon_count = 1;
More information about the mesa-commit
mailing list