summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2020-11-16 23:01:24 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2020-11-16 23:01:24 +0000
commit5b4e68d756c68b279fe89d47f29b762e3b45267c (patch)
treea6962975ddce015c21dc6d04bf8fb9e7f9c70190
parent6c8e3812b9af97caa41d329ece983df59bc74d73 (diff)
parentc1bd43fee53b55a9b2be1bb924a78d8eb54187b3 (diff)
Merge changes I4e5db32c,I2a448282
* changes: binder_ndk: fix performance-noexcept-move-constructor binder_ndk: fix bugprone-unhandled-self-assignment
-rw-r--r--libs/binder/ndk/include_cpp/android/binder_auto_utils.h9
1 files changed, 7 insertions, 2 deletions
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 8d60226725..2d85f90968 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 @@ class SpAIBinder {
* 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 @@ class ScopedAResource {
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;