Fix non-explicit single-argument ctors.
Change-Id: Ie92b3263b8690312dd54c4f51792eff1e1918cb0
diff --git a/src/profiling/common/callstack_trie.h b/src/profiling/common/callstack_trie.h
index d711cf5..d2f1d33 100644
--- a/src/profiling/common/callstack_trie.h
+++ b/src/profiling/common/callstack_trie.h
@@ -29,7 +29,7 @@
namespace profiling {
struct Mapping {
- Mapping(Interned<std::string> b) : build_id(std::move(b)) {}
+ explicit Mapping(Interned<std::string> b) : build_id(std::move(b)) {}
Interned<std::string> build_id;
uint64_t exact_offset = 0;
@@ -104,7 +104,7 @@
friend class GlobalCallstackTrie;
// Allow building a node out of a frame for base::LookupSet.
- Node(Interned<Frame> frame) : Node(frame, 0, nullptr) {}
+ explicit Node(Interned<Frame> frame) : Node(frame, 0, nullptr) {}
Node(Interned<Frame> frame, uint64_t id)
: Node(std::move(frame), id, nullptr) {}
Node(Interned<Frame> frame, uint64_t id, Node* parent)
diff --git a/src/profiling/common/interner.h b/src/profiling/common/interner.h
index 7490ef2..636b103 100644
--- a/src/profiling/common/interner.h
+++ b/src/profiling/common/interner.h
@@ -57,7 +57,7 @@
class Interned {
public:
friend class Interner<T>;
- Interned(Entry* entry) : entry_(entry) {}
+ explicit Interned(Entry* entry) : entry_(entry) {}
Interned(const Interned& other) : entry_(other.entry_) {
if (entry_ != nullptr)
entry_->ref_count++;
diff --git a/src/profiling/common/unwind_support.h b/src/profiling/common/unwind_support.h
index 76a2652..f58562a 100644
--- a/src/profiling/common/unwind_support.h
+++ b/src/profiling/common/unwind_support.h
@@ -50,7 +50,7 @@
// TODO(fmayer): Figure out deduplication to other maps.
class FDMaps : public unwindstack::Maps {
public:
- FDMaps(base::ScopedFile fd);
+ explicit FDMaps(base::ScopedFile fd);
FDMaps(const FDMaps&) = delete;
FDMaps& operator=(const FDMaps&) = delete;
@@ -75,7 +75,7 @@
class FDMemory : public unwindstack::Memory {
public:
- FDMemory(base::ScopedFile mem_fd);
+ explicit FDMemory(base::ScopedFile mem_fd);
size_t Read(uint64_t addr, void* dst, size_t size) override;
private:
diff --git a/src/profiling/memory/bookkeeping.h b/src/profiling/memory/bookkeeping.h
index 83c3892..e69be9f 100644
--- a/src/profiling/memory/bookkeeping.h
+++ b/src/profiling/memory/bookkeeping.h
@@ -108,7 +108,7 @@
// Sum of all the allocations for a given callstack.
struct CallstackAllocations {
- CallstackAllocations(GlobalCallstackTrie::Node* n) : node(n) {}
+ explicit CallstackAllocations(GlobalCallstackTrie::Node* n) : node(n) {}
uint64_t allocs = 0;
diff --git a/src/profiling/memory/heapprofd_producer.h b/src/profiling/memory/heapprofd_producer.h
index ffc0fbd..010e499 100644
--- a/src/profiling/memory/heapprofd_producer.h
+++ b/src/profiling/memory/heapprofd_producer.h
@@ -104,7 +104,8 @@
// Alternatively, find a better name for this.
class SocketDelegate : public base::UnixSocket::EventListener {
public:
- SocketDelegate(HeapprofdProducer* producer) : producer_(producer) {}
+ explicit SocketDelegate(HeapprofdProducer* producer)
+ : producer_(producer) {}
void OnDisconnect(base::UnixSocket* self) override;
void OnNewIncomingConnection(
@@ -218,7 +219,8 @@
};
struct DataSource {
- DataSource(std::unique_ptr<TraceWriter> tw) : trace_writer(std::move(tw)) {
+ explicit DataSource(std::unique_ptr<TraceWriter> tw)
+ : trace_writer(std::move(tw)) {
// Make MSAN happy.
memset(&client_configuration, 0, sizeof(client_configuration));
}
diff --git a/src/profiling/memory/java_hprof_producer.h b/src/profiling/memory/java_hprof_producer.h
index d584f44..4f962ab 100644
--- a/src/profiling/memory/java_hprof_producer.h
+++ b/src/profiling/memory/java_hprof_producer.h
@@ -38,7 +38,7 @@
class JavaHprofProducer : public Producer {
public:
- JavaHprofProducer(base::TaskRunner* task_runner)
+ explicit JavaHprofProducer(base::TaskRunner* task_runner)
: task_runner_(task_runner), weak_factory_(this) {}
// Producer Impl:
diff --git a/src/profiling/memory/page_idle_checker.h b/src/profiling/memory/page_idle_checker.h
index f9c73cd..2c9eff5 100644
--- a/src/profiling/memory/page_idle_checker.h
+++ b/src/profiling/memory/page_idle_checker.h
@@ -32,7 +32,7 @@
class PageIdleChecker {
public:
- PageIdleChecker(base::ScopedFile page_idle_fd)
+ explicit PageIdleChecker(base::ScopedFile page_idle_fd)
: page_idle_fd_(std::move(page_idle_fd)) {}
// Return number of bytes of allocation of size bytes starting at alloc that
diff --git a/src/profiling/memory/sampler.h b/src/profiling/memory/sampler.h
index 6740d17..8779201 100644
--- a/src/profiling/memory/sampler.h
+++ b/src/profiling/memory/sampler.h
@@ -40,7 +40,7 @@
// NB: not thread-safe, requires external synchronization.
class Sampler {
public:
- Sampler(uint64_t sampling_interval)
+ explicit Sampler(uint64_t sampling_interval)
: sampling_interval_(sampling_interval),
sampling_rate_(1.0 / static_cast<double>(sampling_interval)),
random_engine_(kSamplerSeed),
diff --git a/src/profiling/memory/shared_ring_buffer.h b/src/profiling/memory/shared_ring_buffer.h
index 4479e81..35cc87c 100644
--- a/src/profiling/memory/shared_ring_buffer.h
+++ b/src/profiling/memory/shared_ring_buffer.h
@@ -65,7 +65,7 @@
Buffer(Buffer&&) = default;
Buffer& operator=(Buffer&&) = default;
- operator bool() const { return data != nullptr; }
+ explicit operator bool() const { return data != nullptr; }
uint8_t* data = nullptr;
size_t size = 0;
diff --git a/src/profiling/memory/system_property.h b/src/profiling/memory/system_property.h
index 38aa35e..f713940 100644
--- a/src/profiling/memory/system_property.h
+++ b/src/profiling/memory/system_property.h
@@ -50,7 +50,7 @@
friend class SystemProperties;
~Handle();
- operator bool();
+ explicit operator bool();
private:
explicit Handle(SystemProperties* system_properties, std::string property);
diff --git a/src/profiling/memory/unhooked_allocator.h b/src/profiling/memory/unhooked_allocator.h
index 45a6262..b379e36 100644
--- a/src/profiling/memory/unhooked_allocator.h
+++ b/src/profiling/memory/unhooked_allocator.h
@@ -49,7 +49,8 @@
: unhooked_malloc_(unhooked_malloc), unhooked_free_(unhooked_free) {}
template <typename U>
- constexpr UnhookedAllocator(const UnhookedAllocator<U>& other) noexcept
+ constexpr explicit UnhookedAllocator(
+ const UnhookedAllocator<U>& other) noexcept
: unhooked_malloc_(other.unhooked_malloc_),
unhooked_free_(other.unhooked_free_) {}
diff --git a/src/profiling/perf/unwinding.h b/src/profiling/perf/unwinding.h
index 46c3760..4b7b091 100644
--- a/src/profiling/perf/unwinding.h
+++ b/src/profiling/perf/unwinding.h
@@ -206,7 +206,7 @@
// owned state, and consolidate.
class UnwinderHandle {
public:
- UnwinderHandle(Unwinder::Delegate* delegate) {
+ explicit UnwinderHandle(Unwinder::Delegate* delegate) {
std::mutex init_lock;
std::condition_variable init_cv;