Fix google-explicit-constructor warnings in libs/hwui.
* Add explicit keyword to conversion constructors,
or add NOLINT for implicit converters.
Bug: 28341362
Test: build with WITH_TIDY=1
Change-Id: Id8ca42433a4fc3652e4cb13787c4cb169f20d9a9
diff --git a/libs/hwui/utils/FatVector.h b/libs/hwui/utils/FatVector.h
index 93d37c2..df8cb076 100644
--- a/libs/hwui/utils/FatVector.h
+++ b/libs/hwui/utils/FatVector.h
@@ -53,7 +53,7 @@
typedef T value_type; // needed to implement std::allocator
typedef T* pointer; // needed to implement std::allocator
- InlineStdAllocator(Allocation& allocation)
+ explicit InlineStdAllocator(Allocation& allocation)
: mAllocation(allocation) {}
InlineStdAllocator(const InlineStdAllocator& other)
: mAllocation(other.mAllocation) {}
@@ -93,7 +93,7 @@
this->reserve(SIZE);
}
- FatVector(size_t capacity) : FatVector() {
+ explicit FatVector(size_t capacity) : FatVector() {
this->resize(capacity);
}
diff --git a/libs/hwui/utils/LinearAllocator.h b/libs/hwui/utils/LinearAllocator.h
index 34c8c6b..f95a6fe 100644
--- a/libs/hwui/utils/LinearAllocator.h
+++ b/libs/hwui/utils/LinearAllocator.h
@@ -157,7 +157,7 @@
typedef T value_type; // needed to implement std::allocator
typedef T* pointer; // needed to implement std::allocator
- LinearStdAllocator(LinearAllocator& allocator)
+ explicit LinearStdAllocator(LinearAllocator& allocator)
: linearAllocator(allocator) {}
LinearStdAllocator(const LinearStdAllocator& other)
: linearAllocator(other.linearAllocator) {}
@@ -170,7 +170,7 @@
};
// enable allocators to be constructed from other templated types
template <class U>
- LinearStdAllocator(const LinearStdAllocator<U>& other)
+ LinearStdAllocator(const LinearStdAllocator<U>& other) // NOLINT(implicit)
: linearAllocator(other.linearAllocator) {}
T* allocate(size_t num, const void* = 0) {
@@ -195,7 +195,7 @@
template <class T>
class LsaVector : public std::vector<T, LinearStdAllocator<T>> {
public:
- LsaVector(const LinearStdAllocator<T>& allocator)
+ explicit LsaVector(const LinearStdAllocator<T>& allocator)
: std::vector<T, LinearStdAllocator<T>>(allocator) {}
};