-
Notifications
You must be signed in to change notification settings - Fork 740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SYCL] Follow rule of three in sycl headers #16080
base: sycl
Are you sure you want to change the base?
Conversation
TempAssignGuard(const TempAssignGuard<T> &) = delete; | ||
TempAssignGuard operator=(const TempAssignGuard<T> &) = delete; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whole point of this class is to use the constructor to temporary assign a value. Since the copy assignment/copy constructor cant take an extra assignment for the temp value to assign these functions are not useful.
pipe_base() = default; | ||
~pipe_base() = default; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exists so derived classes can instantiate pipe_base, so just marking as default explicitly.
@@ -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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this class only has a state member variable, so the default destructor should be fine.
sycl/include/sycl/detail/common.hpp
Outdated
tls_code_loc_t(const tls_code_loc_t &TLSCodeLoc) = default; | ||
tls_code_loc_t &operator=(const tls_code_loc_t &TLSCodeLoc) = default; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class just has the MLocalScope
member variable, so default works fine here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be delete
instead. One of the main jobs of tls_code_loc_t
is to maintain the global state in GCodeLocTLS
. If we copy object, we could end up with the copy resetting the global state before the top-level copy of it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, fixed in the latest commit
image_mem_impl(const image_mem_impl&) = delete; | ||
image_mem_impl& operator=(const image_mem_impl&) = delete; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class is managed by another class image_mem
, which keeps this in a shared pointer. So it probably does not make sense to be able to copy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@steffenlarsen deleting the |
Alternatively, you could put the deleted ctors under the |
Addresses rule-of-three coverity hits in sycl headers