BpfMap - fix a clang warning: misc-unconventional-assign-operator
//system/bpf/libbpf_android:libbpf_android_test clang-tidy BpfMapTest.cpp
system/bpf/libbpf_android/include/bpf/BpfMap.h:138:5: warning: operator=() should return 'BpfMap&' [misc-unconventional-assign-operator]
void operator=(BpfMap<Key, Value>&& other) noexcept {
^
Test: builds without warnings
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I0bb0d42f58bba58c7b9220f062453d827438e85a
diff --git a/libbpf_android/include/bpf/BpfMap.h b/libbpf_android/include/bpf/BpfMap.h
index c42801a..bdffc0f 100644
--- a/libbpf_android/include/bpf/BpfMap.h
+++ b/libbpf_android/include/bpf/BpfMap.h
@@ -133,10 +133,11 @@
return *this;
}
- // Move constructor
- void operator=(BpfMap<Key, Value>&& other) noexcept {
+ // Move assignment operator
+ BpfMap<Key, Value>& operator=(BpfMap<Key, Value>&& other) noexcept {
mMapFd = std::move(other.mMapFd);
other.reset(-1);
+ return *this;
}
void reset(base::unique_fd fd) = delete;