glsl: Don't hide the type of struct_declaration_list.
authorEric Anholt <eric@anholt.net>
Thu, 26 Apr 2012 17:16:52 +0000 (10:16 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 9 Jul 2012 18:12:18 +0000 (11:12 -0700)
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@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/glsl/ast.h
src/glsl/glsl_parser.yy
src/glsl/glsl_parser_extras.cpp

index b096c838c06d45276da019091f5191791d9b8db4..7538b58e4602aa5fe4a6abb11309df412e44973b 100644 (file)
@@ -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;
 };
 
index 531d257c9d1a4ff02aaa7b5ec89e6313a5674086..8759863271e14e2b00bee0e53ac0dd0e0a01363c 100644 (file)
@@ -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);
        }
        ;
index c19b6f9e6a42e78436e54bda98212cdbea2ad9d7..d9ee406cfd472c4bece904ea3dd22906c02bcccd 100644 (file)
@@ -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;