Add noexcept to move constructors and assignment operators.
Bug: 116614593
Test: build with WITH_TIDY=1
Change-Id: I47101c362198665194f8b3248751caaa7da32505
diff --git a/libs/vr/libvrflinger/acquired_buffer.cpp b/libs/vr/libvrflinger/acquired_buffer.cpp
index 9614c6d..5d873d1 100644
--- a/libs/vr/libvrflinger/acquired_buffer.cpp
+++ b/libs/vr/libvrflinger/acquired_buffer.cpp
@@ -31,13 +31,13 @@
}
}
-AcquiredBuffer::AcquiredBuffer(AcquiredBuffer&& other) {
+AcquiredBuffer::AcquiredBuffer(AcquiredBuffer&& other) noexcept {
*this = std::move(other);
}
AcquiredBuffer::~AcquiredBuffer() { Release(LocalHandle(kEmptyFence)); }
-AcquiredBuffer& AcquiredBuffer::operator=(AcquiredBuffer&& other) {
+AcquiredBuffer& AcquiredBuffer::operator=(AcquiredBuffer&& other) noexcept {
if (this != &other) {
Release();
diff --git a/libs/vr/libvrflinger/acquired_buffer.h b/libs/vr/libvrflinger/acquired_buffer.h
index 32e912a..1a200aa 100644
--- a/libs/vr/libvrflinger/acquired_buffer.h
+++ b/libs/vr/libvrflinger/acquired_buffer.h
@@ -31,7 +31,7 @@
AcquiredBuffer(const std::shared_ptr<BufferConsumer>& buffer, int* error);
// Move constructor. Behaves similarly to the move assignment operator below.
- AcquiredBuffer(AcquiredBuffer&& other);
+ AcquiredBuffer(AcquiredBuffer&& other) noexcept;
~AcquiredBuffer();
@@ -39,7 +39,7 @@
// |other| into this instance after RELEASING the current BufferConsumer and
// closing the acquire fence. After the move |other| is left in the empty
// state.
- AcquiredBuffer& operator=(AcquiredBuffer&& other);
+ AcquiredBuffer& operator=(AcquiredBuffer&& other) noexcept;
// Accessors for the underlying BufferConsumer, the acquire fence, and the
// use-case specific sequence value from the acquisition (see
diff --git a/libs/vr/libvrflinger/hardware_composer.cpp b/libs/vr/libvrflinger/hardware_composer.cpp
index 44ce78c..b8d5e2b 100644
--- a/libs/vr/libvrflinger/hardware_composer.cpp
+++ b/libs/vr/libvrflinger/hardware_composer.cpp
@@ -1272,9 +1272,9 @@
Layer::~Layer() { Reset(); }
-Layer::Layer(Layer&& other) { *this = std::move(other); }
+Layer::Layer(Layer&& other) noexcept { *this = std::move(other); }
-Layer& Layer::operator=(Layer&& other) {
+Layer& Layer::operator=(Layer&& other) noexcept {
if (this != &other) {
Reset();
using std::swap;
diff --git a/libs/vr/libvrflinger/hardware_composer.h b/libs/vr/libvrflinger/hardware_composer.h
index 1d8d463..539a7fb 100644
--- a/libs/vr/libvrflinger/hardware_composer.h
+++ b/libs/vr/libvrflinger/hardware_composer.h
@@ -86,8 +86,8 @@
const std::shared_ptr<IonBuffer>& buffer, HWC::BlendMode blending,
HWC::Composition composition_type, size_t z_order);
- Layer(Layer&&);
- Layer& operator=(Layer&&);
+ Layer(Layer&&) noexcept;
+ Layer& operator=(Layer&&) noexcept;
~Layer();