From 2c45bc9137c29f886e69923535aff31a74d90829 Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Tue, 25 Oct 2016 16:54:12 +0100 Subject: Remove H[Reverse]PostOrderIterator and HInsertionOrderIterator. Use range-based loops instead, introducing helper functions ReverseRange() for iteration in reverse order in containers. When the contents of the underlying container change inside the loop, use an index-based loop that better exposes the container data modifications, compared to the old iterator interface that's hiding it which may lead to subtle bugs. Test: m test-art-host Change-Id: I2a4e6c508b854c37a697fc4b1e8423a8c92c5ea0 --- compiler/optimizing/instruction_builder.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'compiler/optimizing/instruction_builder.cc') diff --git a/compiler/optimizing/instruction_builder.cc b/compiler/optimizing/instruction_builder.cc index 613e00843f..c8c4ca76fd 100644 --- a/compiler/optimizing/instruction_builder.cc +++ b/compiler/optimizing/instruction_builder.cc @@ -81,8 +81,7 @@ void HInstructionBuilder::InitializeBlockLocals() { // locals (guaranteed by HGraphBuilder) and that all try blocks have been // visited already (from HTryBoundary scoping and reverse post order). bool catch_block_visited = false; - for (HReversePostOrderIterator it(*graph_); !it.Done(); it.Advance()) { - HBasicBlock* current = it.Current(); + for (HBasicBlock* current : graph_->GetReversePostOrder()) { if (current == current_block_) { catch_block_visited = true; } else if (current->IsTryBlock()) { @@ -276,8 +275,8 @@ bool HInstructionBuilder::Build() { FindNativeDebugInfoLocations(native_debug_info_locations); } - for (HReversePostOrderIterator block_it(*graph_); !block_it.Done(); block_it.Advance()) { - current_block_ = block_it.Current(); + for (HBasicBlock* block : graph_->GetReversePostOrder()) { + current_block_ = block; uint32_t block_dex_pc = current_block_->GetDexPc(); InitializeBlockLocals(); -- cgit v1.2.3-59-g8ed1b