glsl: Add an is_declaration field to ast_struct_specifier.
authorMatt Turner <mattst88@gmail.com>
Wed, 26 Jun 2013 22:53:12 +0000 (15:53 -0700)
committerMatt Turner <mattst88@gmail.com>
Fri, 12 Jul 2013 03:58:59 +0000 (20:58 -0700)
Will be used in a later commit to differentiate between a structure type
declaration and a variable declaration of a struct type. I.e., the
difference between

   struct S { float x; }; (is_declaration = true)

and

   S s;                   (is_declaration = false)

Also note that is_declaration = true for

   struct S { float x; } s;

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/glsl/ast.h
src/glsl/glsl_parser_extras.cpp

index 87f987682cd304d5c55a44fc8efe7d889cea3e7e..8abea5225f03ea2d273b5107f6cdb2d464234b09 100644 (file)
@@ -460,7 +460,8 @@ public:
     * be modified. Zeros the inherited ast_node's fields.
     */
    ast_struct_specifier(const ast_struct_specifier& that):
-      ast_node(), name(that.name), declarations(that.declarations)
+      ast_node(), name(that.name), declarations(that.declarations),
+      is_declaration(that.is_declaration)
    {
       /* empty */
    }
@@ -475,6 +476,7 @@ public:
    const char *name;
    /* List of ast_declarator_list * */
    exec_list declarations;
+   bool is_declaration;
 };
 
 
index 664f8d159175fd119f0d8b00979799ff6b248972..aa5a435fa95c2ccea3b55d21116e51687818c041 100644 (file)
@@ -1236,6 +1236,7 @@ ast_struct_specifier::ast_struct_specifier(const char *identifier,
    }
    name = identifier;
    this->declarations.push_degenerate_list_at_head(&declarator_list->link);
+   is_declaration = true;
 }
 
 extern "C" {