Fix google-explicit-constructor warnings in art.
* Add explicit keyword to conversion constructors,
or NOLINT for implicit converters.
Bug: 28341362
Test: build with WITH_TIDY=1
Change-Id: I1e1ee2661812944904fedadeff97b620506db47d
diff --git a/runtime/base/allocator.h b/runtime/base/allocator.h
index e48eca9..8d1c982 100644
--- a/runtime/base/allocator.h
+++ b/runtime/base/allocator.h
@@ -116,7 +116,8 @@
// Used internally by STL data structures.
template <class U>
- TrackingAllocatorImpl(const TrackingAllocatorImpl<U, kTag>& alloc ATTRIBUTE_UNUSED) noexcept {}
+ TrackingAllocatorImpl( // NOLINT, implicit
+ const TrackingAllocatorImpl<U, kTag>& alloc ATTRIBUTE_UNUSED) noexcept {}
// Used internally by STL data structures.
TrackingAllocatorImpl() noexcept {
diff --git a/runtime/base/arena_allocator.h b/runtime/base/arena_allocator.h
index 3fad96b..31dbb36 100644
--- a/runtime/base/arena_allocator.h
+++ b/runtime/base/arena_allocator.h
@@ -258,9 +258,9 @@
class ArenaPool {
public:
- ArenaPool(bool use_malloc = true,
- bool low_4gb = false,
- const char* name = "LinearAlloc");
+ explicit ArenaPool(bool use_malloc = true,
+ bool low_4gb = false,
+ const char* name = "LinearAlloc");
~ArenaPool();
Arena* AllocArena(size_t size) REQUIRES(!lock_);
void FreeArenaChain(Arena* first) REQUIRES(!lock_);
diff --git a/runtime/base/arena_containers.h b/runtime/base/arena_containers.h
index 68cacd5..2c8aa28 100644
--- a/runtime/base/arena_containers.h
+++ b/runtime/base/arena_containers.h
@@ -132,7 +132,7 @@
arena_allocator_(arena_allocator) {
}
template <typename U>
- ArenaAllocatorAdapter(const ArenaAllocatorAdapter<U>& other)
+ ArenaAllocatorAdapter(const ArenaAllocatorAdapter<U>& other) // NOLINT, implicit
: ArenaAllocatorAdapterKind(other),
arena_allocator_(other.arena_allocator_) {
}
@@ -168,7 +168,7 @@
arena_allocator_(arena_allocator) {
}
template <typename U>
- ArenaAllocatorAdapter(const ArenaAllocatorAdapter<U>& other)
+ ArenaAllocatorAdapter(const ArenaAllocatorAdapter<U>& other) // NOLINT, implicit
: ArenaAllocatorAdapterKind(other),
arena_allocator_(other.arena_allocator_) {
}
diff --git a/runtime/base/scoped_arena_containers.h b/runtime/base/scoped_arena_containers.h
index bd19d00..7964705 100644
--- a/runtime/base/scoped_arena_containers.h
+++ b/runtime/base/scoped_arena_containers.h
@@ -87,7 +87,7 @@
arena_stack_(arena_allocator->arena_stack_) {
}
template <typename U>
- ScopedArenaAllocatorAdapter(const ScopedArenaAllocatorAdapter<U>& other)
+ ScopedArenaAllocatorAdapter(const ScopedArenaAllocatorAdapter<U>& other) // NOLINT, implicit
: DebugStackReference(other),
DebugStackIndirectTopRef(other),
ArenaAllocatorAdapterKind(other),
@@ -130,7 +130,7 @@
arena_stack_(arena_allocator->arena_stack_) {
}
template <typename U>
- ScopedArenaAllocatorAdapter(const ScopedArenaAllocatorAdapter<U>& other)
+ ScopedArenaAllocatorAdapter(const ScopedArenaAllocatorAdapter<U>& other) // NOLINT, implicit
: DebugStackReference(other),
DebugStackIndirectTopRef(other),
ArenaAllocatorAdapterKind(other),
diff --git a/runtime/base/transform_array_ref.h b/runtime/base/transform_array_ref.h
index a4e0bc2..b432f86 100644
--- a/runtime/base/transform_array_ref.h
+++ b/runtime/base/transform_array_ref.h
@@ -72,7 +72,7 @@
template <typename OtherBT,
typename = typename std::enable_if<std::is_same<BaseType, const OtherBT>::value>::type>
- TransformArrayRef(const TransformArrayRef<OtherBT, Function>& other)
+ TransformArrayRef(const TransformArrayRef<OtherBT, Function>& other) // NOLINT, implicit
: TransformArrayRef(other.base(), other.GetFunction()) { }
// Assignment operators.
diff --git a/runtime/base/transform_iterator.h b/runtime/base/transform_iterator.h
index 9c8f822..f1a8a52 100644
--- a/runtime/base/transform_iterator.h
+++ b/runtime/base/transform_iterator.h
@@ -62,7 +62,7 @@
: data_(base, fn) { }
template <typename OtherBI>
- TransformIterator(const TransformIterator<OtherBI, Function>& other)
+ TransformIterator(const TransformIterator<OtherBI, Function>& other) // NOLINT, implicit
: data_(other.base(), other.GetFunction()) {
}