Skip to content

Commit f4222e2

Browse files
committed
Remove support for ID_next_symbol
This is never used in CBMC's code base.
1 parent 35336a4 commit f4222e2

File tree

9 files changed

+15
-87
lines changed

9 files changed

+15
-87
lines changed

src/ansi-c/expr2c.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1663,9 +1663,6 @@ std::string expr2ct::convert_symbol(const exprt &src)
16631663
#endif
16641664
}
16651665

1666-
if(src.id()==ID_next_symbol)
1667-
dest="NEXT("+dest+")";
1668-
16691666
return dest;
16701667
}
16711668

@@ -3850,9 +3847,6 @@ std::string expr2ct::convert_with_precedence(
38503847
else if(src.id()==ID_symbol)
38513848
return convert_symbol(src);
38523849

3853-
else if(src.id()==ID_next_symbol)
3854-
return convert_symbol(src);
3855-
38563850
else if(src.id()==ID_nondet_symbol)
38573851
return convert_nondet_symbol(to_nondet_symbol_expr(src));
38583852

src/ansi-c/goto_check_c.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ void goto_check_ct::invalidate(const exprt &lhs)
466466
for(auto it = assertions.begin(); it != assertions.end();)
467467
{
468468
if(
469-
has_symbol(it->second, lhs_id, kindt::F_EXPR_CURRENT) ||
469+
has_symbol(it->second, lhs_id, kindt::F_EXPR) ||
470470
has_subexpr(it->second, ID_dereference))
471471
{
472472
it = assertions.erase(it);

src/goto-programs/slice_global_inits.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void slice_global_inits(
6464
for(const auto &i : it->second.body.instructions)
6565
{
6666
i.apply([&symbols_to_keep](const exprt &expr) {
67-
find_symbols(expr, symbols_to_keep, true, false);
67+
find_symbols(expr, symbols_to_keep);
6868
});
6969
}
7070
}
@@ -103,7 +103,7 @@ void slice_global_inits(
103103
symbols_to_keep.find(id) != symbols_to_keep.end())
104104
{
105105
fixed_point_reached = false;
106-
find_symbols(instruction.assign_rhs(), symbols_to_keep, true, false);
106+
find_symbols(instruction.assign_rhs(), symbols_to_keep);
107107
*seen_it = true;
108108
}
109109
}

src/goto-symex/postcondition.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ bool postconditiont::is_used(
167167
for(const exprt &e :
168168
value_set.get_value_set(to_dereference_expr(expr).pointer(), ns))
169169
{
170-
if(has_symbol(get_original_name(e), identifier, kindt::F_EXPR_BOTH))
170+
if(has_symbol(get_original_name(e), identifier, kindt::F_EXPR))
171171
{
172172
return true;
173173
}

src/goto-symex/precondition.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ void preconditiont::compute_rec(exprt &dest)
117117
for(const exprt &e : value_sets.get_values(
118118
SSA_step.source.function_id, target, deref_expr.pointer()))
119119
{
120-
if(has_symbol(e, lhs_identifier, kindt::F_EXPR_BOTH))
120+
if(has_symbol(e, lhs_identifier, kindt::F_EXPR))
121121
{
122122
may_alias = true;
123123
break;

src/util/find_macros.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,6 @@ void find_macros(
4242
stack.push(&symbol.value);
4343
}
4444
}
45-
else if(e.id() == ID_next_symbol)
46-
{
47-
const irep_idt &identifier=e.get(ID_identifier);
48-
49-
const symbolt &symbol=ns.lookup(identifier);
50-
51-
if(symbol.is_macro)
52-
{
53-
// inserted?
54-
if(dest.insert(identifier).second)
55-
stack.push(&symbol.value);
56-
}
57-
}
5845
else
5946
{
6047
forall_operands(it, e)

src/util/find_symbols.cpp

Lines changed: 7 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,20 @@ Author: Daniel Kroening, [email protected]
1313
#include "range.h"
1414
#include "std_expr.h"
1515

16-
bool has_symbol(
17-
const exprt &src,
18-
const find_symbols_sett &symbols,
19-
bool current,
20-
bool next)
16+
bool has_symbol(const exprt &src, const find_symbols_sett &symbols)
2117
{
22-
if(src.id() == ID_symbol && current)
18+
if(src.id() == ID_symbol)
2319
return symbols.count(to_symbol_expr(src).get_identifier()) != 0;
24-
else if(src.id() == ID_next_symbol && next)
25-
return symbols.count(src.get(ID_identifier))!=0;
2620
else
2721
{
2822
forall_operands(it, src)
29-
if(has_symbol(*it, symbols, current, next))
23+
if(has_symbol(*it, symbols))
3024
return true;
3125
}
3226

3327
return false;
3428
}
3529

36-
bool has_symbol(
37-
const exprt &src,
38-
const find_symbols_sett &symbols)
39-
{
40-
return has_symbol(src, symbols, true, true);
41-
}
42-
4330
void find_symbols(
4431
const exprt &src,
4532
std::set<symbol_exprt> &dest)
@@ -76,22 +63,12 @@ void find_symbols(kindt kind, const exprt &src, find_symbols_sett &dest)
7663

7764
find_symbols(kind, src.type(), dest);
7865

79-
if(
80-
kind == kindt::F_ALL || kind == kindt::F_EXPR_CURRENT ||
81-
kind == kindt::F_EXPR_BOTH)
66+
if(kind == kindt::F_ALL || kind == kindt::F_EXPR)
8267
{
8368
if(src.id() == ID_symbol)
8469
dest.insert(to_symbol_expr(src).get_identifier());
8570
}
8671

87-
if(
88-
kind == kindt::F_ALL || kind == kindt::F_EXPR_NEXT ||
89-
kind == kindt::F_EXPR_BOTH)
90-
{
91-
if(src.id() == ID_next_symbol)
92-
dest.insert(src.get(ID_identifier));
93-
}
94-
9572
const irept &c_sizeof_type=src.find(ID_C_c_sizeof_type);
9673

9774
if(c_sizeof_type.is_not_nil())
@@ -199,22 +176,10 @@ void find_type_and_expr_symbols(const typet &src, find_symbols_sett &dest)
199176

200177
void find_symbols_or_nexts(const exprt &src, find_symbols_sett &dest)
201178
{
202-
find_symbols(kindt::F_EXPR_BOTH, src, dest);
179+
find_symbols(kindt::F_EXPR, src, dest);
203180
}
204181

205-
void find_symbols(
206-
const exprt &src,
207-
find_symbols_sett &dest,
208-
bool current,
209-
bool next)
182+
void find_symbols(const exprt &src, find_symbols_sett &dest)
210183
{
211-
if(current)
212-
{
213-
if(next)
214-
find_symbols(kindt::F_EXPR_BOTH, src, dest);
215-
else
216-
find_symbols(kindt::F_EXPR_CURRENT, src, dest);
217-
}
218-
else if(next)
219-
find_symbols(kindt::F_EXPR_NEXT, src, dest);
184+
find_symbols(kindt::F_EXPR, src, dest);
220185
}

src/util/find_symbols.h

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,7 @@ enum class kindt
3232
/// pointer.
3333
F_TYPE_NON_PTR,
3434
/// Symbol expressions.
35-
F_EXPR_CURRENT,
36-
/// Next-state symbol expressions.
37-
F_EXPR_NEXT,
38-
/// Current or next-state symbol expressions.
39-
F_EXPR_BOTH,
35+
F_EXPR,
4036
/// All of the above.
4137
F_ALL
4238
};
@@ -50,13 +46,8 @@ DEPRECATED(SINCE(2022, 3, 14, "use find_symbols"))
5046
/// ID_next_symbol
5147
void find_symbols_or_nexts(const exprt &src, find_symbols_sett &dest);
5248

53-
/// Add to the set \p dest the sub-expressions of \p src with id ID_symbol if
54-
/// \p current is true, and ID_next_symbol if \p next is true
55-
void find_symbols(
56-
const exprt &src,
57-
find_symbols_sett &dest,
58-
bool current = true,
59-
bool next = true);
49+
/// Add to the set \p dest the sub-expressions of \p src with id ID_symbol.
50+
void find_symbols(const exprt &src, find_symbols_sett &dest);
6051

6152
/// \return set of sub-expressions of the expressions contained in the range
6253
/// defined by \p begin and \p end which have id ID_symbol or ID_next_symbol
@@ -72,14 +63,6 @@ find_symbols_sett find_symbols_or_nexts(iteratort begin, iteratort end)
7263
return result;
7364
}
7465

75-
/// Add to the set \p dest the sub-expressions of \p src with id ID_symbol if
76-
/// \p current is true, and ID_next_symbol if \p next is true
77-
void find_symbols(
78-
const exprt &src,
79-
find_symbols_sett &dest,
80-
bool current,
81-
bool next);
82-
8366
/// Find sub expressions with id ID_symbol
8467
void find_symbols(
8568
const exprt &src,

src/util/irep_ids.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ IREP_ID_ONE(bitxnor)
5858
IREP_ID_ONE(notequal)
5959
IREP_ID_ONE(if)
6060
IREP_ID_ONE(symbol)
61-
IREP_ID_ONE(next_symbol)
6261
IREP_ID_ONE(nondet_symbol)
6362
IREP_ID_ONE(predicate_symbol)
6463
IREP_ID_ONE(predicate_next_symbol)

0 commit comments

Comments
 (0)