summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/compiler/glsl/glsl_parser.yy10
-rw-r--r--src/compiler/glsl/glsl_parser_extras.cpp15
2 files changed, 11 insertions, 14 deletions
diff --git a/src/compiler/glsl/glsl_parser.yy b/src/compiler/glsl/glsl_parser.yy
index 3e555cf356d..58bbf6f8381 100644
--- a/src/compiler/glsl/glsl_parser.yy
+++ b/src/compiler/glsl/glsl_parser.yy
@@ -2384,7 +2384,15 @@ struct_specifier:
| STRUCT '{' struct_declaration_list '}'
{
void *ctx = state->linalloc;
- $$ = new(ctx) ast_struct_specifier(NULL, $3);
+
+ /* All anonymous structs have the same name. This simplifies matching of
+ * globals whose type is an unnamed struct.
+ *
+ * It also avoids a memory leak when the same shader is compiled over and
+ * over again.
+ */
+ $$ = new(ctx) ast_struct_specifier("#anon_struct", $3);
+
$$->set_location_range(@2, @4);
}
;
diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp
index 77c0ea206f4..94ceb5eb873 100644
--- a/src/compiler/glsl/glsl_parser_extras.cpp
+++ b/src/compiler/glsl/glsl_parser_extras.cpp
@@ -1674,21 +1674,10 @@ ast_struct_specifier::print(void) const
ast_struct_specifier::ast_struct_specifier(const char *identifier,
ast_declarator_list *declarator_list)
+ : name(identifier), layout(NULL), declarations(), is_declaration(true),
+ type(NULL)
{
- if (identifier == NULL) {
- /* All anonymous structs have the same name. This simplifies matching of
- * globals whose type is an unnamed struct.
- *
- * It also avoids a memory leak when the same shader is compiled over and
- * over again.
- */
- identifier = "#anon_struct";
- }
- name = identifier;
this->declarations.push_degenerate_list_at_head(&declarator_list->link);
- is_declaration = true;
- layout = NULL;
- type = NULL;
}
void ast_subroutine_list::print(void) const