Skip to content

Commit 5b250d3

Browse files
authored
Merge pull request #4152 from diffblue/code_asm_ranged_for
introduce a ranged for
2 parents 8ccb377 + f029d95 commit 5b250d3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/ansi-c/c_typecheck_code.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Author: Daniel Kroening, [email protected]
1414
#include <util/c_types.h>
1515
#include <util/config.h>
1616
#include <util/expr_initializer.h>
17+
#include <util/range.h>
1718

1819
#include "ansi_c_declaration.h"
1920

@@ -152,11 +153,12 @@ void c_typecheck_baset::typecheck_asm(code_asmt &code)
152153

153154
typecheck_expr(code_asm_gcc.asm_text());
154155

155-
for(std::size_t i = 1; i < code_asm_gcc.operands().size(); i++)
156+
// the operands are lists of expressions
157+
for(auto &op : ranget<exprt::operandst::iterator>(
158+
code_asm_gcc.operands().begin() + 1, code_asm_gcc.operands().end()))
156159
{
157-
exprt &list = code_asm_gcc.operands()[i];
158-
Forall_operands(it, list)
159-
typecheck_expr(*it);
160+
for(auto &expr : op.operands())
161+
typecheck_expr(expr);
160162
}
161163
}
162164
else if(flavor==ID_msc)

0 commit comments

Comments
 (0)