Skip to content

Construct or_exprt in a non-deprecated way #3793

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/goto-symex/memory_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ void memory_model_baset::read_from(symex_target_equationt &equation)
rf_some=rf_some_operands.front();
else
{
rf_some=or_exprt();
rf_some.operands().swap(rf_some_operands);
rf_some = or_exprt(std::move(rf_some_operands));
}

// Add the read's guard, each of the writes' guards is implied
Expand Down
6 changes: 1 addition & 5 deletions src/solvers/floatbv/float_bv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -789,11 +789,7 @@ exprt float_bvt::relation(
}
else if(rel==relt::LE)
{
or_exprt or_bv;
or_bv.reserve_operands(3);
or_bv.copy_to_operands(less_than3);
or_bv.copy_to_operands(both_zero);
or_bv.copy_to_operands(bitwise_equal);
or_exprt or_bv{{less_than3, both_zero, bitwise_equal}};

return and_exprt(or_bv, not_exprt(nan));
}
Expand Down
7 changes: 4 additions & 3 deletions src/solvers/prop/minimize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,12 @@ literalt prop_minimizet::constraint()
return or_clause.front();
else
{
or_exprt or_expr;
exprt::operandst disjuncts;
disjuncts.reserve(or_clause.size());
forall_literals(it, or_clause)
or_expr.copy_to_operands(literal_exprt(*it));
disjuncts.push_back(literal_exprt(*it));

return prop_conv.convert(or_expr);
return prop_conv.convert(disjunction(disjuncts));
}
}

Expand Down
4 changes: 1 addition & 3 deletions src/util/std_expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ exprt disjunction(const exprt::operandst &op)
return op.front();
else
{
or_exprt result;
result.operands()=op;
return std::move(result);
return or_exprt(exprt::operandst(op));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cast appears to be redundant?

}

Expand Down
5 changes: 5 additions & 0 deletions src/util/std_expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -2563,6 +2563,11 @@ class or_exprt:public multi_ary_exprt
: multi_ary_exprt(ID_or, {op0, op1, op2, op3}, bool_typet())
{
}

explicit or_exprt(exprt::operandst &&_operands)
: multi_ary_exprt(ID_or, std::move(_operands), bool_typet())
{
}
};

/// 1) generates a disjunction for two or more operands
Expand Down