From 0e72e54fa6beabe188f44d6d1ed82010600359f5 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Thu, 22 Feb 2024 09:12:37 -0800 Subject: Add noexcept to move assignment operator and swap function This resolves a couple of Clang Tidy performance warnings. PiperOrigin-RevId: 609394317 Change-Id: Ibebc7e3f7121355b8660284e18c110bb9171d61c --- absl/status/status.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'absl/status/status.h') diff --git a/absl/status/status.h b/absl/status/status.h index 9ce16db9..6cfe49f2 100644 --- a/absl/status/status.h +++ b/absl/status/status.h @@ -452,7 +452,7 @@ class ABSL_ATTRIBUTE_TRIVIAL_ABI Status final { // The moved-from state is valid but unspecified. Status(Status&&) noexcept; - Status& operator=(Status&&); + Status& operator=(Status&&) noexcept; ~Status(); @@ -539,7 +539,7 @@ class ABSL_ATTRIBUTE_TRIVIAL_ABI Status final { // swap() // // Swap the contents of one status with another. - friend void swap(Status& a, Status& b); + friend void swap(Status& a, Status& b) noexcept; //---------------------------------------------------------------------------- // Payload Management APIs @@ -789,7 +789,7 @@ inline Status::Status(Status&& x) noexcept : Status(x.rep_) { x.rep_ = MovedFromRep(); } -inline Status& Status::operator=(Status&& x) { +inline Status& Status::operator=(Status&& x) noexcept { uintptr_t old_rep = rep_; if (x.rep_ != old_rep) { rep_ = x.rep_; @@ -852,7 +852,7 @@ inline void Status::IgnoreError() const { // no-op } -inline void swap(absl::Status& a, absl::Status& b) { +inline void swap(absl::Status& a, absl::Status& b) noexcept { using std::swap; swap(a.rep_, b.rep_); } -- cgit v1.2.3