[Mesa-dev] [PATCH 12/14] glsl: Add an is_declaration field to ast_struct_specifier.
Ian Romanick
idr at freedesktop.org
Thu Jul 11 15:53:32 PDT 2013
On 06/29/2013 07:44 PM, Matt Turner wrote:
> 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;
> ---
> src/glsl/ast.h | 1 +
> src/glsl/glsl_parser_extras.cpp | 1 +
> 2 files changed, 2 insertions(+)
>
> diff --git a/src/glsl/ast.h b/src/glsl/ast.h
> index 0b70bb7..836750b 100644
> --- a/src/glsl/ast.h
> +++ b/src/glsl/ast.h
> @@ -467,6 +467,7 @@ public:
> virtual ir_rvalue *hir(exec_list *instructions,
> struct _mesa_glsl_parse_state *state);
>
> + bool is_declaration;
Does this need to be explicitly initialized to false in the constructor?
> const char *name;
> /* List of ast_declarator_list * */
> exec_list declarations;
> diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
> index 664f8d1..e12582e 100644
> --- a/src/glsl/glsl_parser_extras.cpp
> +++ b/src/glsl/glsl_parser_extras.cpp
> @@ -1234,6 +1234,7 @@ ast_struct_specifier::ast_struct_specifier(const char *identifier,
> identifier = ralloc_asprintf(this, "#anon_struct_%04x", anon_count);
> anon_count++;
> }
> + is_declaration = true;
> name = identifier;
> this->declarations.push_degenerate_list_at_head(&declarator_list->link);
> }
>
More information about the mesa-dev
mailing list