Skip to content

Commit

Permalink
[SYCL] Follow rule of three in sycl headers (#16080)
Browse files Browse the repository at this point in the history
Addresses rule-of-three coverity hits in sycl headers
  • Loading branch information
ayylol authored Nov 21, 2024
1 parent e087d89 commit c833d8a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
7 changes: 7 additions & 0 deletions sycl/include/sycl/detail/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,13 @@ class __SYCL_EXPORT tls_code_loc_t {
/// @brief Iniitializes TLS with CodeLoc if a TLS entry not present
/// @param CodeLoc The code location information to set up the TLS slot with.
tls_code_loc_t(const detail::code_location &CodeLoc);

#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
// Used to maintain global state (GCodeLocTLS), so we do not want to copy
tls_code_loc_t(const tls_code_loc_t &) = delete;
tls_code_loc_t &operator=(const tls_code_loc_t &) = delete;
#endif // __INTEL_PREVIEW_BREAKING_CHANGES

/// If the code location is set up by this instance, reset it.
~tls_code_loc_t();
/// @brief Query the information in the TLS slot
Expand Down
2 changes: 2 additions & 0 deletions sycl/include/sycl/detail/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ template <typename T> struct TempAssignGuard {
TempAssignGuard(T &fld, T tempVal) : field(fld), restoreValue(fld) {
field = tempVal;
}
TempAssignGuard(const TempAssignGuard<T> &) = delete;
TempAssignGuard operator=(const TempAssignGuard<T> &) = delete;
~TempAssignGuard() { field = restoreValue; }
};

Expand Down
4 changes: 2 additions & 2 deletions sycl/include/sycl/ext/intel/experimental/pipes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ namespace experimental {
class pipe_base {

protected:
pipe_base();
~pipe_base();
pipe_base() = default;
~pipe_base() = default;

__SYCL_EXPORT static std::string get_pipe_name(const void *HostPipePtr);
__SYCL_EXPORT static bool wait_non_blocking(const event &E);
Expand Down
3 changes: 3 additions & 0 deletions sycl/include/sycl/ext/oneapi/bindless_images_memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ class image_mem_impl {
const context &syclContext);
__SYCL_EXPORT ~image_mem_impl();

image_mem_impl(const image_mem_impl &) = delete;
image_mem_impl &operator=(const image_mem_impl &) = delete;

raw_handle_type get_handle() const { return handle; }
const image_descriptor &get_descriptor() const { return descriptor; }
sycl::device get_device() const { return syclDevice; }
Expand Down
1 change: 1 addition & 0 deletions sycl/include/sycl/ext/oneapi/experimental/cuda/barrier.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class barrier {
barrier(barrier &&other) noexcept = delete;
barrier &operator=(const barrier &other) = delete;
barrier &operator=(barrier &&other) noexcept = delete;
~barrier() = default;

void initialize(uint32_t expected_count) {
#ifdef __SYCL_DEVICE_ONLY__
Expand Down

0 comments on commit c833d8a

Please sign in to comment.