Skip to content

Commit c32fcb8

Browse files
committed
Deprecate has_symbol
This code does not permit configuration what kinds of symbols are to be found. It had a single user within the code base, and even that one was not a good use of it for it constructed a single-element set.
1 parent bb08494 commit c32fcb8

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/ansi-c/goto_check_c.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,12 +461,12 @@ void goto_check_ct::invalidate(const exprt &lhs)
461461
else if(lhs.id() == ID_symbol)
462462
{
463463
// clear all assertions about 'symbol'
464-
find_symbols_sett find_symbols_set{to_symbol_expr(lhs).get_identifier()};
464+
const irep_idt &lhs_id = to_symbol_expr(lhs).get_identifier();
465465

466466
for(auto it = assertions.begin(); it != assertions.end();)
467467
{
468468
if(
469-
has_symbol(it->second, find_symbols_set) ||
469+
find_symbol_identifiers(it->second).count(lhs_id) != 0 ||
470470
has_subexpr(it->second, ID_dereference))
471471
{
472472
it = assertions.erase(it);

src/util/find_symbols.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ Author: Daniel Kroening, [email protected]
1010
#ifndef CPROVER_UTIL_FIND_SYMBOLS_H
1111
#define CPROVER_UTIL_FIND_SYMBOLS_H
1212

13+
#include "deprecate.h"
14+
#include "irep.h"
15+
1316
#include <algorithm>
1417
#include <set>
1518
#include <unordered_set>
1619

17-
#include "irep.h"
18-
1920
class exprt;
2021
class symbol_exprt;
2122
class typet;
@@ -59,6 +60,7 @@ std::set<symbol_exprt> find_symbols(const exprt &src);
5960
/// Find identifiers of the sub expressions with id ID_symbol
6061
std::unordered_set<irep_idt> find_symbol_identifiers(const exprt &src);
6162

63+
DEPRECATED(SINCE(2022, 3, 14, "pick a specific implementation of find_symbols"))
6264
/// \return true if one of the symbols in \p src is present in \p symbols
6365
bool has_symbol(
6466
const exprt &src,

0 commit comments

Comments
 (0)