Fix google-explicit-constructor warnings in system/core.
* Declare explicit conversion constructors.
* Add NOLINT for implicit conversion constructors.
* Fix also some misaligned indendations.
Bug: 28341362
Change-Id: Idf911f35923b408d92285cc1a053f382ba08c63e
Test: build with clang-tidy
diff --git a/libpixelflinger/codeflinger/CodeCache.h b/libpixelflinger/codeflinger/CodeCache.h
index 0fb6fd5..c0e0684 100644
--- a/libpixelflinger/codeflinger/CodeCache.h
+++ b/libpixelflinger/codeflinger/CodeCache.h
@@ -42,7 +42,7 @@
class AssemblyKey : public AssemblyKeyBase
{
public:
- AssemblyKey(const T& rhs) : mKey(rhs) { }
+ explicit AssemblyKey(const T& rhs) : mKey(rhs) { }
virtual int compare_type(const AssemblyKeyBase& key) const {
const T& rhs = static_cast<const AssemblyKey&>(key).mKey;
return android::compare_type(mKey, rhs);
@@ -56,7 +56,7 @@
class Assembly
{
public:
- Assembly(size_t size);
+ explicit Assembly(size_t size);
virtual ~Assembly();
ssize_t size() const;
@@ -80,13 +80,13 @@
{
public:
// pretty simple cache API...
- CodeCache(size_t size);
- ~CodeCache();
-
- sp<Assembly> lookup(const AssemblyKeyBase& key) const;
+ explicit CodeCache(size_t size);
+ ~CodeCache();
- int cache( const AssemblyKeyBase& key,
- const sp<Assembly>& assembly);
+ sp<Assembly> lookup(const AssemblyKeyBase& key) const;
+
+ int cache(const AssemblyKeyBase& key,
+ const sp<Assembly>& assembly);
private:
// nothing to see here...
@@ -105,7 +105,7 @@
const AssemblyKeyBase* mKey;
public:
key_t() { };
- key_t(const AssemblyKeyBase& k) : mKey(&k) { }
+ explicit key_t(const AssemblyKeyBase& k) : mKey(&k) { }
};
mutable pthread_mutex_t mLock;