Skip to content

Commit ffa25f7

Browse files
authored
Merge pull request #3786 from tautschnig/deprecation-and_exprt
Construct and_exprt in a non-deprecated way
2 parents 37c4d2b + 4819fda commit ffa25f7

File tree

5 files changed

+16
-20
lines changed

5 files changed

+16
-20
lines changed

src/solvers/flattening/functions.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,17 @@ exprt functionst::arguments_equal(const exprt::operandst &o1,
3232
{
3333
PRECONDITION(o1.size() == o2.size());
3434

35-
if(o1.empty())
36-
return true_exprt();
37-
38-
and_exprt and_expr;
39-
and_exprt::operandst &conjuncts=and_expr.operands();
40-
conjuncts.resize(o1.size());
35+
exprt::operandst conjuncts;
36+
conjuncts.reserve(o1.size());
4137

4238
for(std::size_t i=0; i<o1.size(); i++)
4339
{
4440
exprt lhs=o1[i];
4541
exprt rhs = typecast_exprt::conditional_cast(o2[i], o1[i].type());
46-
conjuncts[i]=equal_exprt(lhs, rhs);
42+
conjuncts.push_back(equal_exprt(lhs, rhs));
4743
}
4844

49-
return std::move(and_expr);
45+
return conjunction(conjuncts);
5046
}
5147

5248
void functionst::add_function_constraints(const function_infot &info)

src/solvers/floatbv/float_bv.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -777,13 +777,11 @@ exprt float_bvt::relation(
777777

778778
if(rel==relt::LT)
779779
{
780-
and_exprt and_bv;
781-
and_bv.reserve_operands(4);
782-
and_bv.copy_to_operands(less_than3);
783-
// for the case of two negative numbers
784-
and_bv.copy_to_operands(not_exprt(bitwise_equal));
785-
and_bv.copy_to_operands(not_exprt(both_zero));
786-
and_bv.copy_to_operands(not_exprt(nan));
780+
and_exprt and_bv{{less_than3,
781+
// for the case of two negative numbers
782+
not_exprt(bitwise_equal),
783+
not_exprt(both_zero),
784+
not_exprt(nan)}};
787785

788786
return std::move(and_bv);
789787
}

src/util/guard.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ void guardt::add(const exprt &expr)
5252
}
5353
else if(id()!=ID_and)
5454
{
55-
and_exprt a;
56-
a.add_to_operands(*this);
55+
and_exprt a({*this});
5756
*this=a;
5857
}
5958

src/util/std_expr.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ exprt conjunction(const exprt::operandst &op)
5353
return op.front();
5454
else
5555
{
56-
and_exprt result;
57-
result.operands()=op;
58-
return std::move(result);
56+
return and_exprt(exprt::operandst(op));
5957
}
6058
}
6159

src/util/std_expr.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2467,6 +2467,11 @@ class and_exprt:public multi_ary_exprt
24672467
: multi_ary_exprt(ID_and, {op0, op1, op2, op3}, bool_typet())
24682468
{
24692469
}
2470+
2471+
explicit and_exprt(exprt::operandst &&_operands)
2472+
: multi_ary_exprt(ID_and, std::move(_operands), bool_typet())
2473+
{
2474+
}
24702475
};
24712476

24722477
/// 1) generates a conjunction for two or more operands

0 commit comments

Comments
 (0)