Skip to content

Commit e7c110e

Browse files
authored
Merge pull request #5553 from tautschnig/forall_operands-const
forall_operands should not trigger any non-const operations
2 parents 27f2a8a + a11293d commit e7c110e

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/util/expr.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,19 @@ Author: Daniel Kroening, kroening@kroening.com
99
#ifndef CPROVER_UTIL_EXPR_H
1010
#define CPROVER_UTIL_EXPR_H
1111

12+
#include "as_const.h"
1213
#include "deprecate.h"
1314
#include "type.h"
1415
#include "validate_expressions.h"
1516
#include "validate_types.h"
1617
#include "validation_mode.h"
1718

18-
#define forall_operands(it, expr) \
19-
if((expr).has_operands()) /* NOLINT(readability/braces) */ \
20-
for(exprt::operandst::const_iterator it=(expr).operands().begin(), \
21-
it##_end=(expr).operands().end(); \
22-
it!=it##_end; ++it)
19+
#define forall_operands(it, expr) \
20+
for(exprt::operandst::const_iterator \
21+
it = as_const(expr).operands().begin(), \
22+
it##_end = as_const(expr).operands().end(); \
23+
it != it##_end; \
24+
++it)
2325

2426
#define Forall_operands(it, expr) \
2527
if((expr).has_operands()) /* NOLINT(readability/braces) */ \

src/util/simplify_utils.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ Author: Daniel Kroening, kroening@kroening.com
77
\*******************************************************************/
88

99
#include "simplify_utils.h"
10-
#include "as_const.h"
1110

1211
#include <algorithm>
1312

src/util/std_expr.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ Author: Daniel Kroening, kroening@kroening.com
1313
/// \file util/std_expr.h
1414
/// API to expression classes
1515

16-
#include "as_const.h"
1716
#include "expr_cast.h"
1817
#include "invariant.h"
1918
#include "narrow.h"

0 commit comments

Comments
 (0)