Merge changes I4e5db32c,I2a448282
* changes:
binder_ndk: fix performance-noexcept-move-constructor
binder_ndk: fix bugprone-unhandled-self-assignment
diff --git a/libs/binder/ndk/include_cpp/android/binder_auto_utils.h b/libs/binder/ndk/include_cpp/android/binder_auto_utils.h
index 8d60226..2d85f90 100644
--- a/libs/binder/ndk/include_cpp/android/binder_auto_utils.h
+++ b/libs/binder/ndk/include_cpp/android/binder_auto_utils.h
@@ -74,6 +74,9 @@
* ownership of that other object.
*/
SpAIBinder& operator=(const SpAIBinder& other) {
+ if (this == &other) {
+ return *this;
+ }
AIBinder_incStrong(other.mBinder);
set(other.mBinder);
return *this;
@@ -170,8 +173,10 @@
ScopedAResource& operator=(const ScopedAResource&) = delete;
// move-constructing/assignment is okay
- ScopedAResource(ScopedAResource&& other) : mT(std::move(other.mT)) { other.mT = DEFAULT; }
- ScopedAResource& operator=(ScopedAResource&& other) {
+ ScopedAResource(ScopedAResource&& other) noexcept : mT(std::move(other.mT)) {
+ other.mT = DEFAULT;
+ }
+ ScopedAResource& operator=(ScopedAResource&& other) noexcept {
set(other.mT);
other.mT = DEFAULT;
return *this;