diff --git a/xla/tsl/concurrency/async_value_ref.h b/xla/tsl/concurrency/async_value_ref.h index 625c9085323b5..417d73ca67e56 100644 --- a/xla/tsl/concurrency/async_value_ref.h +++ b/xla/tsl/concurrency/async_value_ref.h @@ -88,8 +88,8 @@ class AsyncValueRef { AsyncValueRef(const AsyncValueRef&) = default; AsyncValueRef& operator=(const AsyncValueRef&) = default; - AsyncValueRef(AsyncValueRef&&) = default; - AsyncValueRef& operator=(AsyncValueRef&&) = default; + AsyncValueRef(AsyncValueRef&&) noexcept = default; + AsyncValueRef& operator=(AsyncValueRef&&) noexcept = default; explicit AsyncValueRef(RCReference value) : value_(std::move(value)) {} @@ -953,13 +953,13 @@ class AsyncValueOwningRef { AsyncValueOwningRef(const AsyncValueOwningRef&) = delete; AsyncValueOwningRef& operator=(const AsyncValueOwningRef&) = delete; - AsyncValueOwningRef& operator=(AsyncValueOwningRef&& other) { + AsyncValueOwningRef& operator=(AsyncValueOwningRef&& other) noexcept { Destroy(); std::swap(value_, other.value_); return *this; } - AsyncValueOwningRef(AsyncValueOwningRef&& other) { + AsyncValueOwningRef(AsyncValueOwningRef&& other) noexcept { Destroy(); std::swap(value_, other.value_); } diff --git a/xla/tsl/concurrency/ref_count.h b/xla/tsl/concurrency/ref_count.h index 664dd95c4c486..4ea65eeaff791 100644 --- a/xla/tsl/concurrency/ref_count.h +++ b/xla/tsl/concurrency/ref_count.h @@ -124,7 +124,7 @@ class RCReference { public: RCReference() : pointer_(nullptr) {} - RCReference(RCReference&& other) : pointer_(other.pointer_) { + RCReference(RCReference&& other) noexcept : pointer_(other.pointer_) { other.pointer_ = nullptr; } @@ -132,7 +132,7 @@ class RCReference { if (pointer_) pointer_->AddRef(); } - RCReference& operator=(RCReference&& other) { + RCReference& operator=(RCReference&& other) noexcept { reset(other.pointer_); other.pointer_ = nullptr; return *this; @@ -187,7 +187,7 @@ class RCReference { explicit operator bool() const { return pointer_ != nullptr; } - void swap(RCReference& other) { + void swap(RCReference& other) noexcept { using std::swap; swap(pointer_, other.pointer_); } @@ -256,7 +256,7 @@ RCReference MakeRef(Args&&... args) { } // For ADL style swap. template -void swap(RCReference& a, RCReference& b) { +void swap(RCReference& a, RCReference& b) noexcept { a.swap(b); }