From 2180a4be7a629e45f09727ad38fc1cbc7e56855e Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 23 Aug 2016 12:35:57 -0400 Subject: [PATCH] basic_block: Use a range-based for loop for iteration --- src/frontend/ir/basic_block.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/frontend/ir/basic_block.cpp b/src/frontend/ir/basic_block.cpp index 23a07bce..383d95fb 100644 --- a/src/frontend/ir/basic_block.cpp +++ b/src/frontend/ir/basic_block.cpp @@ -57,8 +57,8 @@ std::string DumpBlock(const IR::Block& block) { } }; - for (auto inst = block.begin(); inst != block.end(); ++inst) { - const Opcode op = inst->GetOpcode(); + for (const auto& inst : block) { + const Opcode op = inst.GetOpcode(); if (GetTypeOf(op) != Type::Void) { ret += Common::StringFromFormat("%%%-5zu = ", index); @@ -70,7 +70,7 @@ std::string DumpBlock(const IR::Block& block) { const size_t arg_count = GetNumArgsOf(op); for (size_t arg_index = 0; arg_index < arg_count; arg_index++) { - const Value arg = inst->GetArg(arg_index); + const Value arg = inst.GetArg(arg_index); ret += arg_index != 0 ? ", " : " "; ret += arg_to_string(arg); @@ -83,7 +83,7 @@ std::string DumpBlock(const IR::Block& block) { } ret += "\n"; - inst_to_index[&*inst] = index++; + inst_to_index[&inst] = index++; } return ret;