glsl: Pass ast_type_qualifier by const reference.
authorMatt Turner <mattst88@gmail.com>
Mon, 23 Nov 2015 22:22:48 +0000 (14:22 -0800)
committerMatt Turner <mattst88@gmail.com>
Tue, 24 Nov 2015 18:05:33 +0000 (10:05 -0800)
Coverity noticed that we were passing this by value, and it's 152 bytes.

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
src/glsl/ast.h
src/glsl/ast_type.cpp
src/glsl/glsl_parser_extras.cpp

index 3bea63ea0ed89c1e4957de55ab918f40d0d47db3..adfc7938bffbe183a428b9f3b8c65e6c7457ffb5 100644 (file)
@@ -699,16 +699,16 @@ struct ast_type_qualifier {
 
    bool merge_qualifier(YYLTYPE *loc,
                        _mesa_glsl_parse_state *state,
-                       ast_type_qualifier q);
+                       const ast_type_qualifier &q);
 
    bool merge_out_qualifier(YYLTYPE *loc,
                            _mesa_glsl_parse_state *state,
-                           ast_type_qualifier q,
+                           const ast_type_qualifier &q,
                            ast_node* &node);
 
    bool merge_in_qualifier(YYLTYPE *loc,
                            _mesa_glsl_parse_state *state,
-                           ast_type_qualifier q,
+                           const ast_type_qualifier &q,
                            ast_node* &node);
 
    ast_subroutine_list *subroutine_list;
@@ -1152,7 +1152,7 @@ class ast_cs_input_layout : public ast_node
 {
 public:
    ast_cs_input_layout(const struct YYLTYPE &locp,
-                       ast_layout_expression **local_size)
+                       ast_layout_expression *const *local_size)
    {
       for (int i = 0; i < 3; i++) {
          this->local_size[i] = local_size[i];
@@ -1197,6 +1197,6 @@ check_builtin_array_max_size(const char *name, unsigned size,
 extern void _mesa_ast_process_interface_block(YYLTYPE *locp,
                                               _mesa_glsl_parse_state *state,
                                               ast_interface_block *const block,
-                                              const struct ast_type_qualifier q);
+                                              const struct ast_type_qualifier &q);
 
 #endif /* AST_H */
index 03ed4dcfa2a59e0fa8f7a7571fbbb5cd606007c4..8643b7bfb761df00bb8cad3746099c7afe9649c8 100644 (file)
@@ -116,7 +116,7 @@ ast_type_qualifier::interpolation_string() const
 bool
 ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
                                    _mesa_glsl_parse_state *state,
-                                   ast_type_qualifier q)
+                                   const ast_type_qualifier &q)
 {
    ast_type_qualifier ubo_mat_mask;
    ubo_mat_mask.flags.i = 0;
@@ -293,7 +293,7 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
 bool
 ast_type_qualifier::merge_out_qualifier(YYLTYPE *loc,
                                         _mesa_glsl_parse_state *state,
-                                        ast_type_qualifier q,
+                                        const ast_type_qualifier &q,
                                         ast_node* &node)
 {
    void *mem_ctx = state;
@@ -309,7 +309,7 @@ ast_type_qualifier::merge_out_qualifier(YYLTYPE *loc,
 bool
 ast_type_qualifier::merge_in_qualifier(YYLTYPE *loc,
                                        _mesa_glsl_parse_state *state,
-                                       ast_type_qualifier q,
+                                       const ast_type_qualifier &q,
                                        ast_node* &node)
 {
    void *mem_ctx = state;
index 84b3aca1a829b9b675f2a8d28f7262e3f6a04a00..7da4aba6b3d7a856ce3507cd884282559b10fb09 100644 (file)
@@ -874,7 +874,7 @@ void
 _mesa_ast_process_interface_block(YYLTYPE *locp,
                                   _mesa_glsl_parse_state *state,
                                   ast_interface_block *const block,
-                                  const struct ast_type_qualifier q)
+                                  const struct ast_type_qualifier &q)
 {
    if (q.flags.q.buffer) {
       if (!state->has_shader_storage_buffer_objects()) {