Fix google-explicit-constructor warnings in frameworks/rs.
* Declare explicit conversion constructors.
* Add NOLINT to implicit conversion constructors.
Bug: 28341362
Test: build with clang-tidy
Change-Id: If5114de668c1c8946b8fca9cee4b2b14f95be5f1
diff --git a/cpp/util/RefBase.h b/cpp/util/RefBase.h
index 01c0b5f..40bb7bc 100644
--- a/cpp/util/RefBase.h
+++ b/cpp/util/RefBase.h
@@ -202,12 +202,12 @@
inline wp() : m_ptr(0) { }
- wp(T* other);
+ explicit wp(T* other);
wp(const wp<T>& other);
- wp(const sp<T>& other);
- template<typename U> wp(U* other);
- template<typename U> wp(const sp<U>& other);
- template<typename U> wp(const wp<U>& other);
+ explicit wp(const sp<T>& other);
+ template<typename U> explicit wp(U* other);
+ template<typename U> explicit wp(const sp<U>& other);
+ template<typename U> explicit wp(const wp<U>& other);
~wp();
diff --git a/cpp/util/StrongPointer.h b/cpp/util/StrongPointer.h
index 0f68615..a9995ba 100644
--- a/cpp/util/StrongPointer.h
+++ b/cpp/util/StrongPointer.h
@@ -65,10 +65,10 @@
public:
inline sp() : m_ptr(0) { }
- sp(T* other);
+ sp(T* other); // NOLINT, implicit
sp(const sp<T>& other);
- template<typename U> sp(U* other);
- template<typename U> sp(const sp<U>& other);
+ template<typename U> sp(U* other); // NOLINT, implicit
+ template<typename U> sp(const sp<U>& other); // NOLINT, implicit
~sp();
diff --git a/cpp/util/TypeHelpers.h b/cpp/util/TypeHelpers.h
index 33a5201..e738cd3 100644
--- a/cpp/util/TypeHelpers.h
+++ b/cpp/util/TypeHelpers.h
@@ -233,7 +233,7 @@
key_value_pair_t() { }
key_value_pair_t(const key_value_pair_t& o) : key(o.key), value(o.value) { }
key_value_pair_t(const KEY& k, const VALUE& v) : key(k), value(v) { }
- key_value_pair_t(const KEY& k) : key(k) { }
+ explicit key_value_pair_t(const KEY& k) : key(k) { }
inline bool operator < (const key_value_pair_t& o) const {
return strictly_order_type(key, o.key);
}