diff options
author | Francisco Jerez <[email protected]> | 2013-09-20 15:36:38 -0700 |
---|---|---|
committer | Francisco Jerez <[email protected]> | 2013-10-01 17:30:51 -0700 |
commit | 8bd1c69f3bc731a53d785aa7b3e8fea05bacef7d (patch) | |
tree | 313a298efb8b34f92169efa1774f43f185d4171d /src/glsl/ast.h | |
parent | 70953b5fea1445fe121ac4b4a816c984742f2e19 (diff) |
glsl: Switch ast_node to the non-zeroing allocator.
All member variables of ast_node are already being initialized from
its constructor, but some of its derived classes were leaving members
uninitialized -- Fix them.
Using rzalloc makes it more likely that we will start relying on the
allocator to zero out all memory if the class is ever extended with
new member variables. That's bad because it ties objects to some
specific allocation scheme, and gives unpredictable results when an
object is created with a different allocator -- Stack allocation,
array allocation, or aggregation inside a different object are some of
the useful possibilities that come to my mind.
v2: Use NULL initialization instead of default construction for pointers.
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl/ast.h')
-rw-r--r-- | src/glsl/ast.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/glsl/ast.h b/src/glsl/ast.h index c3361a10662..320e8ddd0e5 100644 --- a/src/glsl/ast.h +++ b/src/glsl/ast.h @@ -49,7 +49,7 @@ struct YYLTYPE; */ class ast_node { public: - DECLARE_RZALLOC_CXX_OPERATORS(ast_node); + DECLARE_RALLOC_CXX_OPERATORS(ast_node); /** * Print an AST node in something approximating the original GLSL code @@ -576,6 +576,10 @@ public: virtual void print(void) const; bool has_qualifiers() const; + ast_fully_specified_type() : qualifier(), specifier(NULL) + { + } + const struct glsl_type *glsl_type(const char **name, struct _mesa_glsl_parse_state *state) const; @@ -859,6 +863,10 @@ public: class ast_function_definition : public ast_node { public: + ast_function_definition() : prototype(NULL), body(NULL) + { + } + virtual void print(void) const; virtual ir_rvalue *hir(exec_list *instructions, |