Fix cpplint runtime/explicit issues
Change-Id: I352ba0b427f1ff9b22887693952b180eae0839ba
diff --git a/runtime/gc/accounting/heap_bitmap.h b/runtime/gc/accounting/heap_bitmap.h
index a12809e..f4b725c 100644
--- a/runtime/gc/accounting/heap_bitmap.h
+++ b/runtime/gc/accounting/heap_bitmap.h
@@ -103,8 +103,7 @@
void ReplaceObjectSet(SpaceSetMap* old_set, SpaceSetMap* new_set)
EXCLUSIVE_LOCKS_REQUIRED(Locks::heap_bitmap_lock_);
- HeapBitmap(Heap* heap) : heap_(heap) {
- }
+ explicit HeapBitmap(Heap* heap) : heap_(heap) {}
private:
diff --git a/runtime/gc/accounting/mod_union_table-inl.h b/runtime/gc/accounting/mod_union_table-inl.h
index 32ac95f..9ea74d4 100644
--- a/runtime/gc/accounting/mod_union_table-inl.h
+++ b/runtime/gc/accounting/mod_union_table-inl.h
@@ -28,8 +28,7 @@
// A mod-union table to record image references to the Zygote and alloc space.
class ModUnionTableToZygoteAllocspace : public ModUnionTableReferenceCache {
public:
- ModUnionTableToZygoteAllocspace(Heap* heap) : ModUnionTableReferenceCache(heap) {
- }
+ explicit ModUnionTableToZygoteAllocspace(Heap* heap) : ModUnionTableReferenceCache(heap) {}
bool AddReference(const mirror::Object* /* obj */, const mirror::Object* ref) {
const std::vector<space::ContinuousSpace*>& spaces = GetHeap()->GetContinuousSpaces();
@@ -48,8 +47,7 @@
// A mod-union table to record Zygote references to the alloc space.
class ModUnionTableToAllocspace : public ModUnionTableReferenceCache {
public:
- ModUnionTableToAllocspace(Heap* heap) : ModUnionTableReferenceCache(heap) {
- }
+ explicit ModUnionTableToAllocspace(Heap* heap) : ModUnionTableReferenceCache(heap) {}
bool AddReference(const mirror::Object* /* obj */, const mirror::Object* ref) {
const std::vector<space::ContinuousSpace*>& spaces = GetHeap()->GetContinuousSpaces();
diff --git a/runtime/gc/accounting/mod_union_table.cc b/runtime/gc/accounting/mod_union_table.cc
index 05b68c4..aa02f82 100644
--- a/runtime/gc/accounting/mod_union_table.cc
+++ b/runtime/gc/accounting/mod_union_table.cc
@@ -117,8 +117,8 @@
class ModUnionScanImageRootVisitor {
public:
- ModUnionScanImageRootVisitor(collector::MarkSweep* const mark_sweep) : mark_sweep_(mark_sweep) {
- }
+ explicit ModUnionScanImageRootVisitor(collector::MarkSweep* const mark_sweep)
+ : mark_sweep_(mark_sweep) {}
void operator ()(const Object* root) const
EXCLUSIVE_LOCKS_REQUIRED(Locks::heap_bitmap_lock_)
diff --git a/runtime/gc/accounting/mod_union_table.h b/runtime/gc/accounting/mod_union_table.h
index 5435625..d46281c 100644
--- a/runtime/gc/accounting/mod_union_table.h
+++ b/runtime/gc/accounting/mod_union_table.h
@@ -49,11 +49,9 @@
// cleared between GC phases, reducing the number of dirty cards that need to be scanned.
class ModUnionTable {
public:
- ModUnionTable(Heap* heap) : heap_(heap) {
- }
+ explicit ModUnionTable(Heap* heap) : heap_(heap) {}
- virtual ~ModUnionTable() {
- }
+ virtual ~ModUnionTable() {}
// Clear cards which map to a memory range of a space. This doesn't immediately update the
// mod-union table, as updating the mod-union table may have an associated cost, such as
@@ -86,7 +84,7 @@
// Reference caching implementation. Caches references pointing to alloc space(s) for each card.
class ModUnionTableReferenceCache : public ModUnionTable {
public:
- ModUnionTableReferenceCache(Heap* heap) : ModUnionTable(heap) {}
+ explicit ModUnionTableReferenceCache(Heap* heap) : ModUnionTable(heap) {}
virtual ~ModUnionTableReferenceCache() {}
// Clear and store cards for a space.
@@ -122,7 +120,7 @@
// Card caching implementation. Keeps track of which cards we cleared and only this information.
class ModUnionTableCardCache : public ModUnionTable {
public:
- ModUnionTableCardCache(Heap* heap) : ModUnionTable(heap) {}
+ explicit ModUnionTableCardCache(Heap* heap) : ModUnionTable(heap) {}
virtual ~ModUnionTableCardCache() {}
// Clear and store cards for a space.
diff --git a/runtime/gc/accounting/space_bitmap.h b/runtime/gc/accounting/space_bitmap.h
index 32ab440..5a1bfe3 100644
--- a/runtime/gc/accounting/space_bitmap.h
+++ b/runtime/gc/accounting/space_bitmap.h
@@ -244,7 +244,7 @@
}
}
- SpaceSetMap(const std::string& name) : name_(name) {}
+ explicit SpaceSetMap(const std::string& name) : name_(name) {}
~SpaceSetMap() {}
Objects& GetObjects() {
diff --git a/runtime/gc/collector/mark_sweep.cc b/runtime/gc/collector/mark_sweep.cc
index 279796f..a5bad2f 100644
--- a/runtime/gc/collector/mark_sweep.cc
+++ b/runtime/gc/collector/mark_sweep.cc
@@ -70,8 +70,7 @@
class SetFingerVisitor {
public:
- SetFingerVisitor(MarkSweep* const mark_sweep) : mark_sweep_(mark_sweep) {
- }
+ explicit SetFingerVisitor(MarkSweep* const mark_sweep) : mark_sweep_(mark_sweep) {}
void operator ()(void* finger) const {
mark_sweep_->SetFinger(reinterpret_cast<Object*>(finger));
@@ -523,10 +522,7 @@
class CheckObjectVisitor {
public:
- CheckObjectVisitor(MarkSweep* const mark_sweep)
- : mark_sweep_(mark_sweep) {
-
- }
+ explicit CheckObjectVisitor(MarkSweep* const mark_sweep) : mark_sweep_(mark_sweep) {}
void operator ()(const Object* obj, const Object* ref, MemberOffset offset, bool is_static) const
NO_THREAD_SAFETY_ANALYSIS {
@@ -566,8 +562,7 @@
class ScanObjectVisitor {
public:
- ScanObjectVisitor(MarkSweep* const mark_sweep) : mark_sweep_(mark_sweep) {
- }
+ explicit ScanObjectVisitor(MarkSweep* const mark_sweep) : mark_sweep_(mark_sweep) {}
// TODO: Fixme when anotatalysis works with visitors.
void operator ()(const Object* obj) const NO_THREAD_SAFETY_ANALYSIS {
@@ -612,8 +607,7 @@
class CheckBitmapVisitor {
public:
- CheckBitmapVisitor(MarkSweep* mark_sweep) : mark_sweep_(mark_sweep) {
- }
+ explicit CheckBitmapVisitor(MarkSweep* mark_sweep) : mark_sweep_(mark_sweep) {}
void operator ()(const Object* obj) const NO_THREAD_SAFETY_ANALYSIS {
if (kDebugLocking) {
@@ -805,9 +799,7 @@
class CheckpointMarkThreadRoots : public Closure {
public:
- CheckpointMarkThreadRoots(MarkSweep* mark_sweep) : mark_sweep_(mark_sweep) {
-
- }
+ explicit CheckpointMarkThreadRoots(MarkSweep* mark_sweep) : mark_sweep_(mark_sweep) {}
virtual void Run(Thread* thread) NO_THREAD_SAFETY_ANALYSIS {
// Note: self is not necessarily equal to thread since thread may be suspended.
@@ -1086,8 +1078,7 @@
class MarkObjectVisitor {
public:
- MarkObjectVisitor(MarkSweep* const mark_sweep) : mark_sweep_(mark_sweep) {
- }
+ explicit MarkObjectVisitor(MarkSweep* const mark_sweep) : mark_sweep_(mark_sweep) {}
// TODO: Fixme when anotatalysis works with visitors.
void operator ()(const Object* /* obj */, const Object* ref, const MemberOffset& /* offset */,
@@ -1155,9 +1146,7 @@
class MarkObjectParallelVisitor {
public:
- MarkObjectParallelVisitor(MarkStackChunk* chunk_task) : chunk_task_(chunk_task) {
-
- }
+ explicit MarkObjectParallelVisitor(MarkStackChunk* chunk_task) : chunk_task_(chunk_task) {}
void operator ()(const Object* /* obj */, const Object* ref,
const MemberOffset& /* offset */, bool /* is_static */) const {
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index 53b8cd9..85b7bf0 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -1173,10 +1173,9 @@
// Verify a reference from an object.
class VerifyReferenceVisitor {
public:
- VerifyReferenceVisitor(Heap* heap)
+ explicit VerifyReferenceVisitor(Heap* heap)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_, Locks::heap_bitmap_lock_)
- : heap_(heap), failed_(false) {
- }
+ : heap_(heap), failed_(false) {}
bool Failed() const {
return failed_;
@@ -1263,8 +1262,7 @@
// Verify all references within an object, for use with HeapBitmap::Visit.
class VerifyObjectVisitor {
public:
- VerifyObjectVisitor(Heap* heap) : heap_(heap), failed_(false) {
- }
+ explicit VerifyObjectVisitor(Heap* heap) : heap_(heap), failed_(false) {}
void operator ()(const mirror::Object* obj) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_, Locks::heap_bitmap_lock_) {
@@ -1376,11 +1374,9 @@
class VerifyLiveStackReferences {
public:
- VerifyLiveStackReferences(Heap* heap)
+ explicit VerifyLiveStackReferences(Heap* heap)
: heap_(heap),
- failed_(false) {
-
- }
+ failed_(false) {}
void operator ()(const mirror::Object* obj) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_, Locks::heap_bitmap_lock_) {
diff --git a/runtime/gc/space/large_object_space.h b/runtime/gc/space/large_object_space.h
index 74d9cca..db845db 100644
--- a/runtime/gc/space/large_object_space.h
+++ b/runtime/gc/space/large_object_space.h
@@ -61,7 +61,7 @@
protected:
- LargeObjectSpace(const std::string& name);
+ explicit LargeObjectSpace(const std::string& name);
// Approximate number of bytes which have been allocated into the space.
size_t num_bytes_allocated_;
@@ -91,7 +91,7 @@
bool Contains(const mirror::Object* obj) const NO_THREAD_SAFETY_ANALYSIS;
private:
- LargeObjectMapSpace(const std::string& name);
+ explicit LargeObjectMapSpace(const std::string& name);
virtual ~LargeObjectMapSpace() {}
// Used to ensure mutual exclusion when the allocation spaces data structures are being modified.