intel/elk: delete copy constructor and copy-assignment-operator

To keep the rule-of-three. This points out that the implicit copy
operations would be dangerous when there is an explicit constructor and
destructor, since the class is holding un-managed memory.

Acked-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29667>
This commit is contained in:
Dylan Baker 2024-06-10 15:19:45 -07:00 committed by Marge Bot
parent 5809209316
commit 3f3cb1e2fa
8 changed files with 28 additions and 0 deletions

View file

@ -326,8 +326,11 @@ struct elk_cfg_t {
DECLARE_RALLOC_CXX_OPERATORS(elk_cfg_t)
elk_cfg_t(const elk_backend_shader *s, exec_list *instructions);
elk_cfg_t(const elk_cfg_t &) = delete;
~elk_cfg_t();
elk_cfg_t & operator=(const elk_cfg_t &) = delete;
void remove_block(elk_bblock_t *block);
elk_bblock_t *first_block();
@ -487,7 +490,9 @@ namespace elk {
*/
struct idom_tree {
idom_tree(const elk_backend_shader *s);
idom_tree(const idom_tree &) = delete;
~idom_tree();
idom_tree & operator=(const idom_tree &) = delete;
bool
validate(const elk_backend_shader *) const

View file

@ -48,7 +48,9 @@ namespace elk {
*/
struct register_pressure {
register_pressure(const elk_fs_visitor *v);
register_pressure(const register_pressure &) = delete;
~register_pressure();
register_pressure & operator=(const register_pressure &) = delete;
analysis_dependency_class
dependency_class() const
@ -186,9 +188,12 @@ public:
const nir_shader *shader,
bool needs_register_pressure,
bool debug_enabled);
elk_fs_visitor(const elk_fs_visitor &) = delete;
void init();
~elk_fs_visitor();
elk_fs_visitor & operator=(const elk_fs_visitor &) = delete;
elk_fs_reg vgrf(const glsl_type *const type);
void import_uniforms(elk_fs_visitor *v);

View file

@ -193,12 +193,16 @@ public:
success = (user_map != NULL && values_to_emit != NULL);
}
combine_constants_result(const combine_constants_result &) = delete;
~combine_constants_result()
{
free(values_to_emit);
free(user_map);
}
combine_constants_result & operator=(const combine_constants_result &) = delete;
void append_value(const nir_const_value &value, unsigned bit_size)
{
values_to_emit[num_values_to_emit].value = value;

View file

@ -78,7 +78,9 @@ public:
};
fs_live_variables(const elk_backend_shader *s);
fs_live_variables(const fs_live_variables &) = delete;
~fs_live_variables();
fs_live_variables & operator=(const fs_live_variables &) = delete;
bool validate(const elk_backend_shader *s) const;

View file

@ -342,6 +342,9 @@ public:
spill_node_count = 0;
}
elk_fs_reg_alloc(const elk_fs_reg_alloc &) = delete;
elk_fs_reg_alloc & operator=(const elk_fs_reg_alloc &) = delete;
~elk_fs_reg_alloc()
{
ralloc_free(mem_ctx);

View file

@ -42,12 +42,16 @@ namespace elk {
{
}
simple_allocator(const simple_allocator &) = delete;
~simple_allocator()
{
free(offsets);
free(sizes);
}
simple_allocator & operator=(const simple_allocator &) = delete;
unsigned
allocate(unsigned size)
{

View file

@ -139,6 +139,7 @@ public:
* object of type \p T.
*/
elk_analysis(const C *c) : c(c), p(NULL) {}
elk_analysis(const elk_analysis &) = delete;
/**
* Destroy a program analysis.
@ -148,6 +149,8 @@ public:
delete p;
}
elk_analysis & operator=(const elk_analysis &) = delete;
/**
* Obtain the result of a program analysis. This gives a
* guaranteed up-to-date result, the analysis pass will be

View file

@ -65,7 +65,9 @@ public:
};
vec4_live_variables(const elk_backend_shader *s);
vec4_live_variables(const vec4_live_variables &) = delete;
~vec4_live_variables();
vec4_live_variables & operator=(const vec4_live_variables &) = delete;
bool
validate(const elk_backend_shader *s) const;