Skip to content

Commit 107b842

Browse files
author
Daniel Kroening
authored
Merge pull request #5371 from diffblue/deprecated_expr
Remove deprecated expression constructors
2 parents 9ff9be8 + 0bf67f7 commit 107b842

File tree

7 files changed

+30
-62
lines changed

7 files changed

+30
-62
lines changed

src/analyses/goto_check.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -829,8 +829,8 @@ void goto_checkt::integer_overflow_check(
829829
return;
830830
}
831831

832-
multi_ary_exprt overflow("overflow-" + expr.id_string(), bool_typet());
833-
overflow.operands()=expr.operands();
832+
multi_ary_exprt overflow(
833+
"overflow-" + expr.id_string(), expr.operands(), bool_typet());
834834

835835
if(expr.operands().size()>=3)
836836
{

src/goto-instrument/accelerate/overflow_instrumenter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ void overflow_instrumentert::overflow_expr(
211211
expr.id()==ID_mult)
212212
{
213213
// A generic arithmetic operation.
214-
multi_ary_exprt overflow("overflow-" + expr.id_string(), bool_typet());
215-
overflow.operands()=expr.operands();
214+
multi_ary_exprt overflow(
215+
"overflow-" + expr.id_string(), expr.operands(), bool_typet());
216216

217217
if(expr.operands().size()>=3)
218218
{

src/goto-symex/field_sensitivity.cpp

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ exprt field_sensitivityt::get_fields(
154154
const struct_typet &type = to_struct_type(ns.follow(ssa_expr.type()));
155155
const struct_union_typet::componentst &components = type.components();
156156

157-
struct_exprt result(ssa_expr.type());
158-
result.reserve_operands(components.size());
157+
struct_exprt::operandst fields;
158+
fields.reserve(components.size());
159159

160160
const exprt &struct_op = ssa_expr.get_original_expr();
161161

@@ -168,14 +168,13 @@ exprt field_sensitivityt::get_fields(
168168
tmp.set_expression(member);
169169
if(was_l2)
170170
{
171-
result.add_to_operands(
172-
state.rename(get_fields(ns, state, tmp), ns).get());
171+
fields.push_back(state.rename(get_fields(ns, state, tmp), ns).get());
173172
}
174173
else
175-
result.add_to_operands(get_fields(ns, state, tmp));
174+
fields.push_back(get_fields(ns, state, tmp));
176175
}
177176

178-
return std::move(result);
177+
return struct_exprt(std::move(fields), ssa_expr.type());
179178
}
180179
#ifdef ENABLE_ARRAY_FIELD_SENSITIVITY
181180
else if(
@@ -190,8 +189,8 @@ exprt field_sensitivityt::get_fields(
190189
const array_typet &type = to_array_type(ssa_expr.type());
191190
const std::size_t array_size = numeric_cast_v<std::size_t>(mp_array_size);
192191

193-
array_exprt result(type);
194-
result.reserve_operands(array_size);
192+
array_exprt::operandst elements;
193+
elements.reserve(array_size);
195194

196195
const exprt &array = ssa_expr.get_original_expr();
197196

@@ -204,14 +203,13 @@ exprt field_sensitivityt::get_fields(
204203
tmp.set_expression(index);
205204
if(was_l2)
206205
{
207-
result.add_to_operands(
208-
state.rename(get_fields(ns, state, tmp), ns).get());
206+
elements.push_back(state.rename(get_fields(ns, state, tmp), ns).get());
209207
}
210208
else
211-
result.add_to_operands(get_fields(ns, state, tmp));
209+
elements.push_back(get_fields(ns, state, tmp));
212210
}
213211

214-
return std::move(result);
212+
return array_exprt(std::move(elements), type);
215213
}
216214
#endif // ENABLE_ARRAY_FIELD_SENSITIVITY
217215
else

src/goto-symex/goto_symex.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,8 +1019,8 @@ bool goto_symext::constant_propagate_replace(
10191019
auto &new_data = f_l1.arguments().at(4);
10201020
auto &old_data = f_l1.arguments().at(3);
10211021

1022-
array_exprt characters_to_find(s_data_opt->get().type());
1023-
array_exprt characters_to_replace(s_data_opt->get().type());
1022+
array_exprt::operandst characters_to_find;
1023+
array_exprt::operandst characters_to_replace;
10241024

10251025
// Two main ways to perform a replace: characters or strings.
10261026
bool is_single_character = new_data.type().id() == ID_unsignedbv &&
@@ -1035,8 +1035,8 @@ bool goto_symext::constant_propagate_replace(
10351035
return {};
10361036
}
10371037

1038-
characters_to_find.operands().emplace_back(old_char_pointer->get());
1039-
characters_to_replace.operands().emplace_back(new_char_pointer->get());
1038+
characters_to_find.emplace_back(old_char_pointer->get());
1039+
characters_to_replace.emplace_back(new_char_pointer->get());
10401040
}
10411041
else
10421042
{
@@ -1054,23 +1054,23 @@ bool goto_symext::constant_propagate_replace(
10541054
return {};
10551055
}
10561056

1057-
characters_to_find = old_char_array_opt->get();
1058-
characters_to_replace = new_char_array_opt->get();
1057+
characters_to_find = old_char_array_opt->get().operands();
1058+
characters_to_replace = new_char_array_opt->get().operands();
10591059
}
10601060

10611061
// Copy data, then do initial search for a replace sequence.
10621062
array_exprt existing_data = s_data_opt->get();
10631063
auto found_pattern = std::search(
10641064
existing_data.operands().begin(),
10651065
existing_data.operands().end(),
1066-
characters_to_find.operands().begin(),
1067-
characters_to_find.operands().end());
1066+
characters_to_find.begin(),
1067+
characters_to_find.end());
10681068

10691069
// If we've found a match, proceed to perform a replace on all instances.
10701070
while(found_pattern != existing_data.operands().end())
10711071
{
10721072
// Find the difference between our first/last match iterator.
1073-
auto match_end = found_pattern + characters_to_find.operands().size();
1073+
auto match_end = found_pattern + characters_to_find.size();
10741074

10751075
// Erase them.
10761076
found_pattern = existing_data.operands().erase(found_pattern, match_end);
@@ -1079,16 +1079,16 @@ bool goto_symext::constant_propagate_replace(
10791079
// our new sequence.
10801080
found_pattern = existing_data.operands().insert(
10811081
found_pattern,
1082-
characters_to_replace.operands().begin(),
1083-
characters_to_replace.operands().end()) +
1084-
characters_to_replace.operands().size();
1082+
characters_to_replace.begin(),
1083+
characters_to_replace.end()) +
1084+
characters_to_replace.size();
10851085

10861086
// Then search from there for any additional matches.
10871087
found_pattern = std::search(
10881088
found_pattern,
10891089
existing_data.operands().end(),
1090-
characters_to_find.operands().begin(),
1091-
characters_to_find.operands().end());
1090+
characters_to_find.begin(),
1091+
characters_to_find.end());
10921092
}
10931093

10941094
const constant_exprt new_char_array_length =

src/util/std_expr.h

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -790,12 +790,6 @@ inline binary_relation_exprt &to_binary_relation_expr(exprt &expr)
790790
class multi_ary_exprt : public expr_protectedt
791791
{
792792
public:
793-
DEPRECATED(SINCE(2018, 12, 7, "use multi_ary_exprt(id, op, type) instead"))
794-
multi_ary_exprt(const irep_idt &_id, const typet &_type)
795-
: expr_protectedt(_id, _type)
796-
{
797-
}
798-
799793
multi_ary_exprt(const irep_idt &_id, operandst _operands, typet _type)
800794
: expr_protectedt(_id, std::move(_type))
801795
{
@@ -1437,12 +1431,6 @@ inline array_of_exprt &to_array_of_expr(exprt &expr)
14371431
class array_exprt : public multi_ary_exprt
14381432
{
14391433
public:
1440-
DEPRECATED(SINCE(2019, 1, 12, "use array_exprt(operands, type) instead"))
1441-
explicit array_exprt(const array_typet &_type)
1442-
: multi_ary_exprt(ID_array, _type)
1443-
{
1444-
}
1445-
14461434
array_exprt(operandst _operands, array_typet _type)
14471435
: multi_ary_exprt(ID_array, std::move(_operands), std::move(_type))
14481436
{
@@ -1644,11 +1632,6 @@ inline union_exprt &to_union_expr(exprt &expr)
16441632
class struct_exprt : public multi_ary_exprt
16451633
{
16461634
public:
1647-
DEPRECATED(SINCE(2019, 1, 12, "use struct_exprt(operands, type) instead"))
1648-
explicit struct_exprt(const typet &_type) : multi_ary_exprt(ID_struct, _type)
1649-
{
1650-
}
1651-
16521635
struct_exprt(operandst _operands, typet _type)
16531636
: multi_ary_exprt(ID_struct, std::move(_operands), std::move(_type))
16541637
{
@@ -1936,12 +1919,6 @@ inline object_descriptor_exprt &to_object_descriptor_expr(exprt &expr)
19361919
class dynamic_object_exprt:public binary_exprt
19371920
{
19381921
public:
1939-
DEPRECATED(SINCE(2019, 2, 11, "use dynamic_object_exprt(type) instead"))
1940-
dynamic_object_exprt()
1941-
: binary_exprt(exprt(ID_unknown), ID_dynamic_object, exprt(ID_unknown))
1942-
{
1943-
}
1944-
19451922
explicit dynamic_object_exprt(typet type)
19461923
: binary_exprt(
19471924
exprt(ID_unknown),
@@ -2006,12 +1983,6 @@ inline dynamic_object_exprt &to_dynamic_object_expr(exprt &expr)
20061983
class is_dynamic_object_exprt : public unary_predicate_exprt
20071984
{
20081985
public:
2009-
DEPRECATED(SINCE(2019, 11, 8, "use is_dynamic_object(op) instead"))
2010-
is_dynamic_object_exprt()
2011-
: unary_predicate_exprt(ID_is_dynamic_object, exprt())
2012-
{
2013-
}
2014-
20151986
explicit is_dynamic_object_exprt(const exprt &op)
20161987
: unary_predicate_exprt(ID_is_dynamic_object, op)
20171988
{

unit/goto-symex/expr_skeleton.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ SCENARIO("expr skeleton", "[core][goto-symex][symex-assign][expr-skeleton]")
2323
const signedbv_typet int_type{32};
2424
const expr_skeletont index_skeleton =
2525
expr_skeletont::remove_op0(index_exprt{
26-
array_exprt{array_typet{int_type, from_integer(2, size_type())}},
26+
array_exprt{{}, array_typet{int_type, from_integer(2, size_type())}},
2727
from_integer(1, size_type())});
2828
const expr_skeletont member_skeleton = expr_skeletont::remove_op0(
2929
member_exprt{symbol_exprt{"struct1", typet{}}, "field1", int_type});

unit/goto-symex/symex_assign.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,7 @@ SCENARIO(
248248
member_exprt{struct1_sym, "field1", int_type}};
249249
struct1_v0_field1.set_level_0(0);
250250
struct1_v0_field1.set_level_2(0);
251-
struct_exprt struct_expr(struct_type);
252-
struct_expr.add_to_operands(struct1_v0_field1);
251+
struct_exprt struct_expr({struct1_v0_field1}, struct_type);
253252
with_exprt struct1_v0_with_field_set = rhs;
254253
struct1_v0_with_field_set.old() = struct_expr;
255254
REQUIRE(assign_step.ssa_rhs == struct1_v0_with_field_set);

0 commit comments

Comments
 (0)