binder_ndk: fix performance-unnecessary-value-param
Bug: 162909698
Test: m libbinder
Change-Id: I89779ab38a28972c1ad15733aff34a51e7e7fa8a
diff --git a/libs/binder/ndk/Android.bp b/libs/binder/ndk/Android.bp
index cecc759..a57beee 100644
--- a/libs/binder/ndk/Android.bp
+++ b/libs/binder/ndk/Android.bp
@@ -98,6 +98,14 @@
"30",
],
},
+ tidy: true,
+ tidy_flags: [
+ // Only check our headers
+ "--header-filter=^.*frameworks/native/libs/binder/.*.h$",
+ ],
+ tidy_checks_as_errors: [
+ "*",
+ ],
}
ndk_headers {
diff --git a/libs/binder/ndk/ibinder.cpp b/libs/binder/ndk/ibinder.cpp
index b927f6f..5e2e1bd 100644
--- a/libs/binder/ndk/ibinder.cpp
+++ b/libs/binder/ndk/ibinder.cpp
@@ -367,7 +367,7 @@
mDeathRecipients.end());
}
-binder_status_t AIBinder_DeathRecipient::linkToDeath(sp<IBinder> binder, void* cookie) {
+binder_status_t AIBinder_DeathRecipient::linkToDeath(const sp<IBinder>& binder, void* cookie) {
CHECK(binder != nullptr);
std::lock_guard<std::mutex> l(mDeathRecipientsMutex);
@@ -386,7 +386,7 @@
return STATUS_OK;
}
-binder_status_t AIBinder_DeathRecipient::unlinkToDeath(sp<IBinder> binder, void* cookie) {
+binder_status_t AIBinder_DeathRecipient::unlinkToDeath(const sp<IBinder>& binder, void* cookie) {
CHECK(binder != nullptr);
std::lock_guard<std::mutex> l(mDeathRecipientsMutex);
diff --git a/libs/binder/ndk/ibinder_internal.h b/libs/binder/ndk/ibinder_internal.h
index 0fa47c6..6236e81 100644
--- a/libs/binder/ndk/ibinder_internal.h
+++ b/libs/binder/ndk/ibinder_internal.h
@@ -161,8 +161,8 @@
};
explicit AIBinder_DeathRecipient(AIBinder_DeathRecipient_onBinderDied onDied);
- binder_status_t linkToDeath(::android::sp<::android::IBinder>, void* cookie);
- binder_status_t unlinkToDeath(::android::sp<::android::IBinder> binder, void* cookie);
+ binder_status_t linkToDeath(const ::android::sp<::android::IBinder>&, void* cookie);
+ binder_status_t unlinkToDeath(const ::android::sp<::android::IBinder>& binder, void* cookie);
private:
// When the user of this API deletes a Bp object but not the death recipient, the