Skip to content

Commit c833d8a

Browse files
authored
[SYCL] Follow rule of three in sycl headers (#16080)
Addresses rule-of-three coverity hits in sycl headers
1 parent e087d89 commit c833d8a

File tree

5 files changed

+15
-2
lines changed

5 files changed

+15
-2
lines changed

sycl/include/sycl/detail/common.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,13 @@ class __SYCL_EXPORT tls_code_loc_t {
134134
/// @brief Iniitializes TLS with CodeLoc if a TLS entry not present
135135
/// @param CodeLoc The code location information to set up the TLS slot with.
136136
tls_code_loc_t(const detail::code_location &CodeLoc);
137+
138+
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
139+
// Used to maintain global state (GCodeLocTLS), so we do not want to copy
140+
tls_code_loc_t(const tls_code_loc_t &) = delete;
141+
tls_code_loc_t &operator=(const tls_code_loc_t &) = delete;
142+
#endif // __INTEL_PREVIEW_BREAKING_CHANGES
143+
137144
/// If the code location is set up by this instance, reset it.
138145
~tls_code_loc_t();
139146
/// @brief Query the information in the TLS slot

sycl/include/sycl/detail/util.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ template <typename T> struct TempAssignGuard {
4545
TempAssignGuard(T &fld, T tempVal) : field(fld), restoreValue(fld) {
4646
field = tempVal;
4747
}
48+
TempAssignGuard(const TempAssignGuard<T> &) = delete;
49+
TempAssignGuard operator=(const TempAssignGuard<T> &) = delete;
4850
~TempAssignGuard() { field = restoreValue; }
4951
};
5052

sycl/include/sycl/ext/intel/experimental/pipes.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ namespace experimental {
4343
class pipe_base {
4444

4545
protected:
46-
pipe_base();
47-
~pipe_base();
46+
pipe_base() = default;
47+
~pipe_base() = default;
4848

4949
__SYCL_EXPORT static std::string get_pipe_name(const void *HostPipePtr);
5050
__SYCL_EXPORT static bool wait_non_blocking(const event &E);

sycl/include/sycl/ext/oneapi/bindless_images_memory.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ class image_mem_impl {
3939
const context &syclContext);
4040
__SYCL_EXPORT ~image_mem_impl();
4141

42+
image_mem_impl(const image_mem_impl &) = delete;
43+
image_mem_impl &operator=(const image_mem_impl &) = delete;
44+
4245
raw_handle_type get_handle() const { return handle; }
4346
const image_descriptor &get_descriptor() const { return descriptor; }
4447
sycl::device get_device() const { return syclDevice; }

sycl/include/sycl/ext/oneapi/experimental/cuda/barrier.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class barrier {
3333
barrier(barrier &&other) noexcept = delete;
3434
barrier &operator=(const barrier &other) = delete;
3535
barrier &operator=(barrier &&other) noexcept = delete;
36+
~barrier() = default;
3637

3738
void initialize(uint32_t expected_count) {
3839
#ifdef __SYCL_DEVICE_ONLY__

0 commit comments

Comments
 (0)