[vm/gardening] clang tidy fixes

https://github.com/dart-lang/sdk/issues/38196

Change-Id: I0a61eae20d8cfc1c2ada8d6a607d437d02136d33
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115609
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Aart Bik <ajcbik@google.com>
This commit is contained in:
Aart Bik 2019-09-05 17:00:33 +00:00 committed by commit-bot@chromium.org
parent 89ad636b58
commit 8ee3f314cb
5 changed files with 19 additions and 6 deletions

View file

@ -38,6 +38,15 @@ final pool = new Pool(max(1, Platform.numberOfProcessors ~/ 2));
// TODO(dartbug.com/38196): Ensure all VM sources are clang-tidy clean.
final Set<String> migratedFiles = Set<String>.from([
'runtime/vm/native_api_impl.cc',
'runtime/vm/compiler/backend/constant_propagator.cc',
'runtime/vm/compiler/backend/flow_graph.cc',
'runtime/vm/compiler/backend/flow_graph_checker.cc',
'runtime/vm/compiler/backend/il.cc',
'runtime/vm/compiler/backend/inliner.cc',
'runtime/vm/compiler/backend/linearscan.cc',
'runtime/vm/compiler/backend/loops.cc',
'runtime/vm/compiler/backend/loops_test.cc',
'runtime/vm/compiler/backend/range_analysis.cc',
]);
main(List<String> files) async {

View file

@ -1895,6 +1895,7 @@ TargetEntryInstr* PolymorphicInliner::BuildDecisionGraph() {
// Unshared. Graft the normal entry on after the check class
// instruction.
auto target = callee_entry->AsGraphEntry()->normal_entry();
ASSERT(cursor != nullptr);
cursor->LinkTo(target->next());
target->ReplaceAsPredecessorWith(current_block);
// Unuse all inputs of the graph entry and the normal entry. They are
@ -1955,6 +1956,7 @@ TargetEntryInstr* PolymorphicInliner::BuildDecisionGraph() {
new TargetEntryInstr(AllocateBlockId(), try_idx, DeoptId::kNone);
below_target->InheritDeoptTarget(zone(), call_);
current_block->AddDominatedBlock(below_target);
ASSERT(cursor != nullptr); // read before overwrite
cursor = current_block = below_target;
*branch_top->true_successor_address() = below_target;
@ -1972,9 +1974,9 @@ TargetEntryInstr* PolymorphicInliner::BuildDecisionGraph() {
}
branch->InheritDeoptTarget(zone(), call_);
cursor = AppendInstruction(cursor, branch);
AppendInstruction(cursor, branch);
cursor = nullptr;
current_block->set_last_instruction(branch);
cursor = NULL;
// 2. Handle a match by linking to the inlined body. There are three
// cases (unshared, shared first predecessor, and shared subsequent
@ -3369,7 +3371,7 @@ bool FlowGraphInliner::TryReplaceInstanceCallWithInline(
}
// Replace all uses of this definition with the result.
if (call->HasUses()) {
ASSERT(result->HasSSATemp());
ASSERT(result != nullptr && result->HasSSATemp());
call->ReplaceUsesWith(result);
}
// Finally insert the sequence other definition in place of this one in the

View file

@ -603,7 +603,8 @@ void FlowGraphAllocator::BuildLiveRanges() {
// Check if any values live into the loop can be spilled for free.
if (block->IsLoopHeader()) {
current_interference_set = NULL;
ASSERT(loop_info != nullptr);
current_interference_set = nullptr;
for (BitVector::Iterator it(liveness_.GetLiveInSetAt(i)); !it.Done();
it.Advance()) {
LiveRange* range = GetLiveRange(it.Current());

View file

@ -7395,8 +7395,8 @@ class Smi : public Integer {
static intptr_t InstanceSize() { return 0; }
static RawSmi* New(intptr_t value) {
RawSmi* raw_smi =
reinterpret_cast<RawSmi*>((value << kSmiTagShift) | kSmiTag);
RawSmi* raw_smi = reinterpret_cast<RawSmi*>(
(static_cast<uintptr_t>(value) << kSmiTagShift) | kSmiTag);
ASSERT(ValueFromRawSmi(raw_smi) == value);
return raw_smi;
}

View file

@ -119,6 +119,7 @@ class Zone {
void Free(ElementType* old_array, intptr_t len) {
#ifdef DEBUG
if (len > 0) {
ASSERT(old_array != nullptr);
memset(old_array, kZapUninitializedByte, len * sizeof(ElementType));
}
#endif