Skip to content

Commit 5d8bcf6

Browse files
authored
[UR][OpenCL] Add deleted copy assignment constructor to ur_adapter_handle_t in OpenCL for rule of 3. Specify noexcept to ur_context_handle_t destructor (#18742)
Fixes some coverity issues. For the `ur_context_handle_t` Coverity was warning an exception is thrown from `[clear](ur::cl::getAdapter()->fnCache.clearCache(CLContext);` however inside here if an error case occurs a call to `std::terminate` so we don't care about the exception.
1 parent 67c3e17 commit 5d8bcf6

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

unified-runtime/source/adapters/opencl/adapter.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ struct ur_adapter_handle_t_ : ur::opencl::handle_base {
2222
~ur_adapter_handle_t_();
2323

2424
ur_adapter_handle_t_(ur_adapter_handle_t_ &) = delete;
25+
ur_adapter_handle_t_ &operator=(const ur_adapter_handle_t_ &) = delete;
2526

2627
std::atomic<uint32_t> RefCount = 0;
2728
logger::Logger &log = logger::get_logger("opencl");

unified-runtime/source/adapters/opencl/context.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ struct ur_context_handle_t_ : ur::opencl::handle_base {
4545
static ur_result_t makeWithNative(native_type Ctx, uint32_t DevCount,
4646
const ur_device_handle_t *phDevices,
4747
ur_context_handle_t &Context);
48-
~ur_context_handle_t_() {
48+
~ur_context_handle_t_() noexcept {
4949
// If we're reasonably sure this context is about to be destroyed we should
5050
// clear the ext function pointer cache. This isn't foolproof sadly but it
5151
// should drastically reduce the chances of the pathological case described

0 commit comments

Comments
 (0)