summaryrefslogtreecommitdiff
path: root/absl
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2024-02-22 09:12:37 -0800
committerGravatar Copybara-Service <copybara-worker@google.com>2024-02-22 09:13:28 -0800
commit0e72e54fa6beabe188f44d6d1ed82010600359f5 (patch)
tree8e35be0c8994d7bf7e08d47378b0b964af77b0b0 /absl
parent3afe4fed61501fe519d984d838e97eba0f3df894 (diff)
Add noexcept to move assignment operator and swap function
This resolves a couple of Clang Tidy performance warnings. PiperOrigin-RevId: 609394317 Change-Id: Ibebc7e3f7121355b8660284e18c110bb9171d61c
Diffstat (limited to 'absl')
-rw-r--r--absl/status/status.h8
1 files changed, 4 insertions, 4 deletions
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_);
}