Skip to content

Commit d4ec86a

Browse files
committed
Rename kindt to symbol_kindt for clarity
This is just a change in the enum tag.
1 parent 8ae2d8c commit d4ec86a

File tree

5 files changed

+45
-39
lines changed

5 files changed

+45
-39
lines changed

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, symbol_kindt::F_EXPR_CURRENT) ||
470470
has_subexpr(it->second, ID_dereference))
471471
{
472472
it = assertions.erase(it);

src/goto-symex/postcondition.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ 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(
171+
get_original_name(e), identifier, symbol_kindt::F_EXPR_BOTH))
171172
{
172173
return true;
173174
}

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, symbol_kindt::F_EXPR_BOTH))
121121
{
122122
may_alias = true;
123123
break;

src/util/find_symbols.cpp

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ bool has_symbol(
4141
}
4242

4343
static bool find_symbols(
44-
kindt,
44+
symbol_kindt,
4545
const typet &,
4646
std::function<bool(const symbol_exprt &)>);
4747

4848
static bool find_symbols(
49-
kindt kind,
49+
symbol_kindt kind,
5050
const exprt &src,
5151
std::function<bool(const symbol_exprt &)> op)
5252
{
@@ -60,16 +60,16 @@ static bool find_symbols(
6060
return false;
6161

6262
if(
63-
kind == kindt::F_ALL || kind == kindt::F_EXPR_CURRENT ||
64-
kind == kindt::F_EXPR_BOTH)
63+
kind == symbol_kindt::F_ALL || kind == symbol_kindt::F_EXPR_CURRENT ||
64+
kind == symbol_kindt::F_EXPR_BOTH)
6565
{
6666
if(src.id() == ID_symbol && !op(to_symbol_expr(src)))
6767
return false;
6868
}
6969

7070
if(
71-
kind == kindt::F_ALL || kind == kindt::F_EXPR_NEXT ||
72-
kind == kindt::F_EXPR_BOTH)
71+
kind == symbol_kindt::F_ALL || kind == symbol_kindt::F_EXPR_NEXT ||
72+
kind == symbol_kindt::F_EXPR_BOTH)
7373
{
7474
if(
7575
src.id() == ID_next_symbol &&
@@ -101,12 +101,11 @@ static bool find_symbols(
101101
}
102102

103103
static bool find_symbols(
104-
kindt kind,
104+
symbol_kindt kind,
105105
const typet &src,
106106
std::function<bool(const symbol_exprt &)> op)
107107
{
108-
if(kind!=kindt::F_TYPE_NON_PTR ||
109-
src.id()!=ID_pointer)
108+
if(kind != symbol_kindt::F_TYPE_NON_PTR || src.id() != ID_pointer)
110109
{
111110
if(
112111
src.has_subtype() &&
@@ -122,8 +121,8 @@ static bool find_symbols(
122121
}
123122

124123
if(
125-
kind == kindt::F_TYPE || kind == kindt::F_TYPE_NON_PTR ||
126-
kind == kindt::F_ALL)
124+
kind == symbol_kindt::F_TYPE || kind == symbol_kindt::F_TYPE_NON_PTR ||
125+
kind == symbol_kindt::F_ALL)
127126
{
128127
const irep_idt &typedef_name = src.get(ID_C_typedef);
129128
if(!typedef_name.empty() && !op(symbol_exprt{typedef_name, typet{}}))
@@ -161,8 +160,8 @@ static bool find_symbols(
161160
return false;
162161
}
163162
else if(
164-
kind == kindt::F_TYPE || kind == kindt::F_TYPE_NON_PTR ||
165-
kind == kindt::F_ALL)
163+
kind == symbol_kindt::F_TYPE || kind == symbol_kindt::F_TYPE_NON_PTR ||
164+
kind == symbol_kindt::F_ALL)
166165
{
167166
if(src.id() == ID_c_enum_tag)
168167
{
@@ -186,13 +185,14 @@ static bool find_symbols(
186185

187186
void find_symbols(const exprt &src, std::set<symbol_exprt> &dest)
188187
{
189-
find_symbols(kindt::F_EXPR_CURRENT, src, [&dest](const symbol_exprt &e) {
190-
dest.insert(e);
191-
return true;
192-
});
188+
find_symbols(
189+
symbol_kindt::F_EXPR_CURRENT, src, [&dest](const symbol_exprt &e) {
190+
dest.insert(e);
191+
return true;
192+
});
193193
}
194194

195-
bool has_symbol(const exprt &src, const irep_idt &identifier, kindt kind)
195+
bool has_symbol(const exprt &src, const irep_idt &identifier, symbol_kindt kind)
196196
{
197197
return !find_symbols(kind, src, [&identifier](const symbol_exprt &e) {
198198
return e.get_identifier() != identifier;
@@ -201,15 +201,15 @@ bool has_symbol(const exprt &src, const irep_idt &identifier, kindt kind)
201201

202202
void find_type_symbols(const exprt &src, find_symbols_sett &dest)
203203
{
204-
find_symbols(kindt::F_TYPE, src, [&dest](const symbol_exprt &e) {
204+
find_symbols(symbol_kindt::F_TYPE, src, [&dest](const symbol_exprt &e) {
205205
dest.insert(e.get_identifier());
206206
return true;
207207
});
208208
}
209209

210210
void find_type_symbols(const typet &src, find_symbols_sett &dest)
211211
{
212-
find_symbols(kindt::F_TYPE, src, [&dest](const symbol_exprt &e) {
212+
find_symbols(symbol_kindt::F_TYPE, src, [&dest](const symbol_exprt &e) {
213213
dest.insert(e.get_identifier());
214214
return true;
215215
});
@@ -219,41 +219,43 @@ void find_non_pointer_type_symbols(
219219
const exprt &src,
220220
find_symbols_sett &dest)
221221
{
222-
find_symbols(kindt::F_TYPE_NON_PTR, src, [&dest](const symbol_exprt &e) {
223-
dest.insert(e.get_identifier());
224-
return true;
225-
});
222+
find_symbols(
223+
symbol_kindt::F_TYPE_NON_PTR, src, [&dest](const symbol_exprt &e) {
224+
dest.insert(e.get_identifier());
225+
return true;
226+
});
226227
}
227228

228229
void find_non_pointer_type_symbols(
229230
const typet &src,
230231
find_symbols_sett &dest)
231232
{
232-
find_symbols(kindt::F_TYPE_NON_PTR, src, [&dest](const symbol_exprt &e) {
233-
dest.insert(e.get_identifier());
234-
return true;
235-
});
233+
find_symbols(
234+
symbol_kindt::F_TYPE_NON_PTR, src, [&dest](const symbol_exprt &e) {
235+
dest.insert(e.get_identifier());
236+
return true;
237+
});
236238
}
237239

238240
void find_type_and_expr_symbols(const exprt &src, find_symbols_sett &dest)
239241
{
240-
find_symbols(kindt::F_ALL, src, [&dest](const symbol_exprt &e) {
242+
find_symbols(symbol_kindt::F_ALL, src, [&dest](const symbol_exprt &e) {
241243
dest.insert(e.get_identifier());
242244
return true;
243245
});
244246
}
245247

246248
void find_type_and_expr_symbols(const typet &src, find_symbols_sett &dest)
247249
{
248-
find_symbols(kindt::F_ALL, src, [&dest](const symbol_exprt &e) {
250+
find_symbols(symbol_kindt::F_ALL, src, [&dest](const symbol_exprt &e) {
249251
dest.insert(e.get_identifier());
250252
return true;
251253
});
252254
}
253255

254256
void find_symbols_or_nexts(const exprt &src, find_symbols_sett &dest)
255257
{
256-
find_symbols(kindt::F_EXPR_BOTH, src, [&dest](const symbol_exprt &e) {
258+
find_symbols(symbol_kindt::F_EXPR_BOTH, src, [&dest](const symbol_exprt &e) {
257259
dest.insert(e.get_identifier());
258260
return true;
259261
});
@@ -272,10 +274,10 @@ void find_symbols(
272274
if(current)
273275
{
274276
if(next)
275-
find_symbols(kindt::F_EXPR_BOTH, src, store);
277+
find_symbols(symbol_kindt::F_EXPR_BOTH, src, store);
276278
else
277-
find_symbols(kindt::F_EXPR_CURRENT, src, store);
279+
find_symbols(symbol_kindt::F_EXPR_CURRENT, src, store);
278280
}
279281
else if(next)
280-
find_symbols(kindt::F_EXPR_NEXT, src, store);
282+
find_symbols(symbol_kindt::F_EXPR_NEXT, src, store);
281283
}

src/util/find_symbols.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class typet;
2424
typedef std::unordered_set<irep_idt> find_symbols_sett;
2525

2626
/// Kinds of symbols to be considered by \ref has_symbol or \ref find_symbols.
27-
enum class kindt
27+
enum class symbol_kindt
2828
{
2929
/// Struct, union, or enum tag symbols.
3030
F_TYPE,
@@ -43,7 +43,10 @@ enum class kindt
4343

4444
/// Returns true if one of the symbols in \p src with identifier \p identifier
4545
/// is of kind \p kind.
46-
bool has_symbol(const exprt &src, const irep_idt &identifier, kindt kind);
46+
bool has_symbol(
47+
const exprt &src,
48+
const irep_idt &identifier,
49+
symbol_kindt kind);
4750

4851
DEPRECATED(SINCE(2022, 3, 14, "use find_symbols"))
4952
/// Add to the set \p dest the sub-expressions of \p src with id ID_symbol or

0 commit comments

Comments
 (0)