Fix cpplint readability/braces issues
Change-Id: I56b88956510077b0e13aad4caee8898313fab55b
diff --git a/Android.mk b/Android.mk
index 0b530fa..6063264 100644
--- a/Android.mk
+++ b/Android.mk
@@ -334,7 +334,7 @@
.PHONY: cpplint-art
cpplint-art:
./art/tools/cpplint.py \
- --filter=-,+build/header_guard,+whitespace/braces,+whitespace/comma,+runtime/explicit,+whitespace/newline,+whitespace/parens,+build/namespaces,+readability/fn_size,+whitespace/operators \
+ --filter=-,+build/header_guard,+whitespace/braces,+whitespace/comma,+runtime/explicit,+whitespace/newline,+whitespace/parens,+build/namespaces,+readability/fn_size,+whitespace/operators,+readability/braces \
$(shell find art -name *.h -o -name *$(ART_CPP_EXTENSION) | grep -v art/compiler/llvm/generated/)
# "mm cpplint-art-aspirational" to see warnings we would like to fix
diff --git a/compiler/dex/arena_allocator.h b/compiler/dex/arena_allocator.h
index cd2141a..3bd733e 100644
--- a/compiler/dex/arena_allocator.h
+++ b/compiler/dex/arena_allocator.h
@@ -83,7 +83,7 @@
void Dump(std::ostream& os) const {
arena_.DumpMemStats(os);
}
- explicit MemStats(const ArenaAllocator &arena) : arena_(arena) {};
+ explicit MemStats(const ArenaAllocator &arena) : arena_(arena) {}
private:
const ArenaAllocator &arena_;
}; // MemStats
diff --git a/compiler/dex/arena_bit_vector.h b/compiler/dex/arena_bit_vector.h
index 2a05b77..4ec8c88 100644
--- a/compiler/dex/arena_bit_vector.h
+++ b/compiler/dex/arena_bit_vector.h
@@ -36,7 +36,7 @@
: p_bits_(bit_vector),
bit_storage_(bit_vector->GetRawStorage()),
bit_index_(0),
- bit_size_(p_bits_->storage_size_ * sizeof(uint32_t) * 8) {};
+ bit_size_(p_bits_->storage_size_ * sizeof(uint32_t) * 8) {}
// Return the position of the next set bit. -1 means end-of-element reached.
int Next() {
@@ -70,7 +70,7 @@
return arena->NewMem(sizeof(ArenaBitVector::Iterator), true,
ArenaAllocator::kAllocGrowableBitMap);
};
- static void operator delete(void* p) {}; // Nop.
+ static void operator delete(void* p) {} // Nop.
private:
ArenaBitVector* const p_bits_;
@@ -81,12 +81,12 @@
ArenaBitVector(ArenaAllocator* arena, unsigned int start_bits, bool expandable,
OatBitMapKind kind = kBitMapMisc);
- ~ArenaBitVector() {};
+ ~ArenaBitVector() {}
static void* operator new(size_t size, ArenaAllocator* arena) {
return arena->NewMem(sizeof(ArenaBitVector), true, ArenaAllocator::kAllocGrowableBitMap);
}
- static void operator delete(void* p) {}; // Nop.
+ static void operator delete(void* p) {} // Nop.
void SetBit(unsigned int num);
void ClearBit(unsigned int num);
diff --git a/compiler/dex/backend.h b/compiler/dex/backend.h
index acfec42..01959b7 100644
--- a/compiler/dex/backend.h
+++ b/compiler/dex/backend.h
@@ -24,12 +24,12 @@
class Backend {
public:
- virtual ~Backend() {};
+ virtual ~Backend() {}
virtual void Materialize() = 0;
virtual CompiledMethod* GetCompiledMethod() = 0;
protected:
- explicit Backend(ArenaAllocator* arena) : arena_(arena) {};
+ explicit Backend(ArenaAllocator* arena) : arena_(arena) {}
ArenaAllocator* const arena_;
}; // Class Backend
diff --git a/compiler/dex/dex_to_dex_compiler.cc b/compiler/dex/dex_to_dex_compiler.cc
index ee68a5d..ab27838 100644
--- a/compiler/dex/dex_to_dex_compiler.cc
+++ b/compiler/dex/dex_to_dex_compiler.cc
@@ -38,9 +38,9 @@
DexCompiler(art::CompilerDriver& compiler,
const DexCompilationUnit& unit)
: driver_(compiler),
- unit_(unit) {};
+ unit_(unit) {}
- ~DexCompiler() {};
+ ~DexCompiler() {}
void Compile();
diff --git a/compiler/dex/frontend.cc b/compiler/dex/frontend.cc
index ae160d6..113a80a 100644
--- a/compiler/dex/frontend.cc
+++ b/compiler/dex/frontend.cc
@@ -218,9 +218,8 @@
if (compiler_backend == kPortable) {
cu->cg.reset(PortableCodeGenerator(cu.get(), cu->mir_graph.get(), &cu->arena,
llvm_compilation_unit));
- } else
+ } else {
#endif
- { // NOLINT(whitespace/braces)
switch (compiler.GetInstructionSet()) {
case kThumb2:
cu->cg.reset(ArmCodeGenerator(cu.get(), cu->mir_graph.get(), &cu->arena));
@@ -234,7 +233,9 @@
default:
LOG(FATAL) << "Unexpected instruction set: " << compiler.GetInstructionSet();
}
+#if defined(ART_USE_PORTABLE_COMPILER)
}
+#endif
cu->cg->Materialize();
diff --git a/compiler/dex/growable_array.h b/compiler/dex/growable_array.h
index 3bfbcd4..08a6478 100644
--- a/compiler/dex/growable_array.h
+++ b/compiler/dex/growable_array.h
@@ -50,7 +50,7 @@
public:
explicit Iterator(GrowableArray* g_list)
: idx_(0),
- g_list_(g_list) {};
+ g_list_(g_list) {}
// NOTE: returns 0/NULL when no next.
// TODO: redo to make usage consistent with other iterators.
@@ -69,7 +69,7 @@
static void* operator new(size_t size, ArenaAllocator* arena) {
return arena->NewMem(sizeof(GrowableArray::Iterator), true, ArenaAllocator::kAllocGrowableArray);
};
- static void operator delete(void* p) {}; // Nop.
+ static void operator delete(void* p) {} // Nop.
private:
size_t idx_;
@@ -155,7 +155,7 @@
static void* operator new(size_t size, ArenaAllocator* arena) {
return arena->NewMem(sizeof(GrowableArray<T>), true, ArenaAllocator::kAllocGrowableArray);
};
- static void operator delete(void* p) {}; // Nop.
+ static void operator delete(void* p) {} // Nop.
private:
ArenaAllocator* const arena_;
diff --git a/compiler/dex/local_value_numbering.h b/compiler/dex/local_value_numbering.h
index d29600a..e3fd7ad 100644
--- a/compiler/dex/local_value_numbering.h
+++ b/compiler/dex/local_value_numbering.h
@@ -33,7 +33,7 @@
class LocalValueNumbering {
public:
- explicit LocalValueNumbering(CompilationUnit* cu) : cu_(cu) {};
+ explicit LocalValueNumbering(CompilationUnit* cu) : cu_(cu) {}
static uint64_t BuildKey(uint16_t op, uint16_t operand1, uint16_t operand2, uint16_t modifier) {
return (static_cast<uint64_t>(op) << 48 | static_cast<uint64_t>(operand1) << 32 |
diff --git a/compiler/dex/mir_graph.cc b/compiler/dex/mir_graph.cc
index 634c576..a768a19 100644
--- a/compiler/dex/mir_graph.cc
+++ b/compiler/dex/mir_graph.cc
@@ -1009,9 +1009,10 @@
/* Turn method name into a legal Linux file name */
void MIRGraph::ReplaceSpecialChars(std::string& str) {
- static const struct { const char before; const char after; } match[] =
- {{'/', '-'}, {';', '#'}, {' ', '#'}, {'$', '+'},
- {'(', '@'}, {')', '@'}, {'<', '='}, {'>', '='}};
+ static const struct { const char before; const char after; } match[] = {
+ {'/', '-'}, {';', '#'}, {' ', '#'}, {'$', '+'},
+ {'(', '@'}, {')', '@'}, {'<', '='}, {'>', '='}
+ };
for (unsigned int i = 0; i < sizeof(match)/sizeof(match[0]); i++) {
std::replace(str.begin(), str.end(), match[i].before, match[i].after);
}
diff --git a/compiler/dex/quick/arm/utility_arm.cc b/compiler/dex/quick/arm/utility_arm.cc
index f2317f3..f41f110 100644
--- a/compiler/dex/quick/arm/utility_arm.cc
+++ b/compiler/dex/quick/arm/utility_arm.cc
@@ -329,16 +329,17 @@
break;
}
DCHECK_GE(static_cast<int>(opcode), 0);
- if (EncodingMap[opcode].flags & IS_BINARY_OP)
+ if (EncodingMap[opcode].flags & IS_BINARY_OP) {
return NewLIR2(opcode, r_dest_src1, r_src2);
- else if (EncodingMap[opcode].flags & IS_TERTIARY_OP) {
- if (EncodingMap[opcode].field_loc[2].kind == kFmtShift)
+ } else if (EncodingMap[opcode].flags & IS_TERTIARY_OP) {
+ if (EncodingMap[opcode].field_loc[2].kind == kFmtShift) {
return NewLIR3(opcode, r_dest_src1, r_src2, shift);
- else
+ } else {
return NewLIR3(opcode, r_dest_src1, r_dest_src1, r_src2);
- } else if (EncodingMap[opcode].flags & IS_QUAD_OP)
+ }
+ } else if (EncodingMap[opcode].flags & IS_QUAD_OP) {
return NewLIR4(opcode, r_dest_src1, r_dest_src1, r_src2, shift);
- else {
+ } else {
LOG(FATAL) << "Unexpected encoding operand count";
return NULL;
}
@@ -406,9 +407,9 @@
break;
}
DCHECK_GE(static_cast<int>(opcode), 0);
- if (EncodingMap[opcode].flags & IS_QUAD_OP)
+ if (EncodingMap[opcode].flags & IS_QUAD_OP) {
return NewLIR4(opcode, r_dest, r_src1, r_src2, shift);
- else {
+ } else {
DCHECK(EncodingMap[opcode].flags & IS_TERTIARY_OP);
return NewLIR3(opcode, r_dest, r_src1, r_src2);
}
@@ -565,11 +566,11 @@
}
break;
case kOpCmp:
- if (ARM_LOWREG(r_dest_src1) && short_form)
+ if (ARM_LOWREG(r_dest_src1) && short_form) {
opcode = (short_form) ? kThumbCmpRI8 : kThumbCmpRR;
- else if (ARM_LOWREG(r_dest_src1))
+ } else if (ARM_LOWREG(r_dest_src1)) {
opcode = kThumbCmpRR;
- else {
+ } else {
short_form = false;
opcode = kThumbCmpHL;
}
@@ -579,9 +580,9 @@
short_form = false;
break;
}
- if (short_form)
+ if (short_form) {
return NewLIR2(opcode, r_dest_src1, abs_value);
- else {
+ } else {
return OpRegRegImm(op, r_dest_src1, r_dest_src1, value);
}
}
diff --git a/compiler/dex/quick/mips/utility_mips.cc b/compiler/dex/quick/mips/utility_mips.cc
index b7546b7..79f6f16 100644
--- a/compiler/dex/quick/mips/utility_mips.cc
+++ b/compiler/dex/quick/mips/utility_mips.cc
@@ -145,9 +145,9 @@
LOG(FATAL) << "Bad case in OpRegImm";
break;
}
- if (short_form)
+ if (short_form) {
res = NewLIR2(opcode, r_dest_src1, abs_value);
- else {
+ } else {
int r_scratch = AllocTemp();
res = LoadConstant(r_scratch, value);
if (op == kOpCmp)
@@ -267,9 +267,9 @@
break;
}
- if (short_form)
+ if (short_form) {
res = NewLIR3(opcode, r_dest, r_src1, value);
- else {
+ } else {
if (r_dest != r_src1) {
res = LoadConstant(r_dest, value);
NewLIR3(opcode, r_dest, r_src1, r_dest);
diff --git a/compiler/dex/quick/mir_to_lir.h b/compiler/dex/quick/mir_to_lir.h
index 7765eaa..0962167 100644
--- a/compiler/dex/quick/mir_to_lir.h
+++ b/compiler/dex/quick/mir_to_lir.h
@@ -225,7 +225,7 @@
bool first_in_pair;
};
- virtual ~Mir2Lir() {};
+ virtual ~Mir2Lir() {}
int32_t s4FromSwitchData(const void* switch_data) {
return *reinterpret_cast<const int32_t*>(switch_data);
diff --git a/runtime/native/dalvik_system_Zygote.cc b/runtime/native/dalvik_system_Zygote.cc
index e6b4513..12dafe0 100644
--- a/runtime/native/dalvik_system_Zygote.cc
+++ b/runtime/native/dalvik_system_Zygote.cc
@@ -259,7 +259,7 @@
static void EnableDebugger() {}
static void EnableKeepCapabilities() {}
-static void DropCapabilitiesBoundingSet() {};
+static void DropCapabilitiesBoundingSet() {}
static void SetCapabilities(int64_t, int64_t) {}
static void SetSchedulerPolicy() {}