[Mesa-dev] [PATCH 12/14] glsl: Add an is_declaration field to ast_struct_specifier.
Matt Turner
mattst88 at gmail.com
Sat Jun 29 19:44:02 PDT 2013
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;
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);
}
--
1.8.1.5
More information about the mesa-dev
mailing list