mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-22 05:20:37 +02:00
compiler/glsl: explicitly delete copy constructor and copy-assign
Most of our visitors have custom destructors because they wrap C types, and need to manually call destructors for those types. Because of this, the implicitly generated copy constructors and copy-assignment operators are not safe due copying pointers rather than data. Since we don't need these features just delete them, so any attempt to use them would be a compilation error. This doesn't fix any existing issue except stopping coverity from complaining, but it does prevent new issues in the future. Acked-by: Caio Oliveira <caio.oliveira@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29662>
This commit is contained in:
parent
3f3cb1e2fa
commit
99f1b7d732
14 changed files with 39 additions and 0 deletions
|
|
@ -1133,7 +1133,9 @@ namespace {
|
|||
class builtin_builder {
|
||||
public:
|
||||
builtin_builder();
|
||||
builtin_builder(const builtin_builder &) = delete;
|
||||
~builtin_builder();
|
||||
builtin_builder & operator=(const builtin_builder &) = delete;
|
||||
|
||||
void initialize();
|
||||
void release();
|
||||
|
|
|
|||
|
|
@ -45,6 +45,9 @@ struct glsl_symbol_table {
|
|||
glsl_symbol_table();
|
||||
~glsl_symbol_table();
|
||||
|
||||
glsl_symbol_table(const glsl_symbol_table &) = delete;
|
||||
glsl_symbol_table & operator=(const glsl_symbol_table &) = delete;
|
||||
|
||||
/* In 1.10, functions and variables have separate namespaces. */
|
||||
bool separate_function_namespace;
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,9 @@ class nir_visitor : public ir_visitor
|
|||
{
|
||||
public:
|
||||
nir_visitor(const struct gl_constants *consts, nir_shader *shader);
|
||||
nir_visitor(const nir_visitor &) = delete;
|
||||
~nir_visitor();
|
||||
nir_visitor & operator=(const nir_visitor &) = delete;
|
||||
|
||||
virtual void visit(ir_variable *);
|
||||
virtual void visit(ir_function *);
|
||||
|
|
|
|||
|
|
@ -40,7 +40,9 @@ class ir_array_refcount_entry
|
|||
{
|
||||
public:
|
||||
ir_array_refcount_entry(ir_variable *var);
|
||||
ir_array_refcount_entry(const ir_array_refcount_entry &) = delete;
|
||||
~ir_array_refcount_entry();
|
||||
ir_array_refcount_entry & operator=(const ir_array_refcount_entry &) = delete;
|
||||
|
||||
ir_variable *var; /* The key: the variable's pointer. */
|
||||
|
||||
|
|
|
|||
|
|
@ -167,6 +167,9 @@ public:
|
|||
ralloc_free(this->mem_ctx);
|
||||
}
|
||||
|
||||
has_recursion_visitor(const has_recursion_visitor &) = delete;
|
||||
has_recursion_visitor & operator=(const has_recursion_visitor &) = delete;
|
||||
|
||||
function *get_function(ir_function_signature *sig)
|
||||
{
|
||||
function *f;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,9 @@
|
|||
class ir_print_visitor : public ir_visitor {
|
||||
public:
|
||||
ir_print_visitor(FILE *f);
|
||||
ir_print_visitor(const ir_print_visitor &) = delete;
|
||||
virtual ~ir_print_visitor();
|
||||
ir_print_visitor & operator=(const ir_print_visitor &) = delete;
|
||||
|
||||
void indent(void);
|
||||
|
||||
|
|
|
|||
|
|
@ -56,6 +56,9 @@ public:
|
|||
this->data_enter = ir_set;
|
||||
}
|
||||
|
||||
ir_validate(const ir_validate &) = delete;
|
||||
ir_validate & operator=(const ir_validate &) = delete;
|
||||
|
||||
~ir_validate()
|
||||
{
|
||||
_mesa_set_destroy(this->ir_set, NULL);
|
||||
|
|
|
|||
|
|
@ -70,7 +70,9 @@ public:
|
|||
class ir_variable_refcount_visitor : public ir_hierarchical_visitor {
|
||||
public:
|
||||
ir_variable_refcount_visitor(void);
|
||||
ir_variable_refcount_visitor(const ir_variable_refcount_visitor &) = delete;
|
||||
~ir_variable_refcount_visitor(void);
|
||||
ir_variable_refcount_visitor & operator=(const ir_variable_refcount_visitor &) = delete;
|
||||
|
||||
virtual ir_visitor_status visit(ir_variable *);
|
||||
virtual ir_visitor_status visit(ir_dereference_variable *);
|
||||
|
|
|
|||
|
|
@ -59,6 +59,9 @@ public:
|
|||
_mesa_set_destroy(this->locals, NULL);
|
||||
}
|
||||
|
||||
call_link_visitor(const call_link_visitor &) = delete;
|
||||
call_link_visitor & operator=(const call_link_visitor &) = delete;
|
||||
|
||||
virtual ir_visitor_status visit(ir_variable *ir)
|
||||
{
|
||||
_mesa_set_add(locals, ir);
|
||||
|
|
|
|||
|
|
@ -192,6 +192,9 @@ public:
|
|||
_mesa_hash_table_destroy(ht, NULL);
|
||||
}
|
||||
|
||||
interface_block_definitions(const interface_block_definitions &) = delete;
|
||||
interface_block_definitions & operator=(const interface_block_definitions &) = delete;
|
||||
|
||||
/**
|
||||
* Lookup the interface definition. Return NULL if none is found.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -687,6 +687,9 @@ public:
|
|||
ralloc_free(this->mem_ctx);
|
||||
}
|
||||
|
||||
array_sizing_visitor(const array_sizing_visitor &) = delete;
|
||||
array_sizing_visitor & operator=(const array_sizing_visitor &) = delete;
|
||||
|
||||
virtual ir_visitor_status visit(ir_variable *var)
|
||||
{
|
||||
const glsl_type *type_without_array;
|
||||
|
|
|
|||
|
|
@ -73,6 +73,9 @@ public:
|
|||
assert(factory_instructions.is_empty());
|
||||
}
|
||||
|
||||
lower_packing_builtins_visitor(const lower_packing_builtins_visitor &) = delete;
|
||||
lower_packing_builtins_visitor & operator=(const lower_packing_builtins_visitor &) = delete;
|
||||
|
||||
bool get_progress() { return progress; }
|
||||
|
||||
void handle_rvalue(ir_rvalue **rvalue)
|
||||
|
|
|
|||
|
|
@ -42,7 +42,9 @@ namespace {
|
|||
class find_precision_visitor : public ir_rvalue_enter_visitor {
|
||||
public:
|
||||
find_precision_visitor(const struct gl_shader_compiler_options *options);
|
||||
find_precision_visitor(const find_precision_visitor &) = delete;
|
||||
~find_precision_visitor();
|
||||
find_precision_visitor & operator=(const find_precision_visitor &) = delete;
|
||||
|
||||
virtual void handle_rvalue(ir_rvalue **rvalue);
|
||||
virtual ir_visitor_status visit_enter(ir_call *ir);
|
||||
|
|
@ -959,6 +961,9 @@ public:
|
|||
_mesa_set_destroy(lower_vars, NULL);
|
||||
}
|
||||
|
||||
lower_variables_visitor(const lower_variables_visitor &) = delete;
|
||||
lower_variables_visitor & operator=(const lower_variables_visitor &) = delete;
|
||||
|
||||
virtual ir_visitor_status visit(ir_variable *var);
|
||||
virtual ir_visitor_status visit_enter(ir_assignment *ir);
|
||||
virtual ir_visitor_status visit_enter(ir_return *ir);
|
||||
|
|
|
|||
|
|
@ -78,6 +78,9 @@ public:
|
|||
_mesa_hash_table_destroy(this->ht, NULL);
|
||||
}
|
||||
|
||||
string_to_uint_map(const string_to_uint_map &) = delete;
|
||||
string_to_uint_map & operator=(const string_to_uint_map &) = delete;
|
||||
|
||||
/**
|
||||
* Remove all mappings from this map.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue