cprover
Loading...
Searching...
No Matches
find_symbols.h
Go to the documentation of this file.
1/*******************************************************************\
2
3Module:
4
5Author: Daniel Kroening, kroening@kroening.com
6
7\*******************************************************************/
8
9
10#ifndef CPROVER_UTIL_FIND_SYMBOLS_H
11#define CPROVER_UTIL_FIND_SYMBOLS_H
12
13#include <algorithm>
14#include <set>
15#include <unordered_set>
16
17#include "irep.h"
18
19class exprt;
20class symbol_exprt;
21class typet;
22
23typedef std::unordered_set<irep_idt> find_symbols_sett;
24
28
31template <typename iteratort>
32find_symbols_sett find_symbols_or_nexts(iteratort begin, iteratort end)
33{
34 static_assert(
35 std::is_base_of<exprt, typename iteratort::value_type>::value,
36 "find_symbols takes exprt iterators as arguments");
37 find_symbols_sett result;
38 std::for_each(
39 begin, end, [&](const exprt &e) { find_symbols_or_nexts(e, result); });
40 return result;
41}
42
45void find_symbols(
46 const exprt &src,
48 bool current,
49 bool next);
50
52void find_symbols(
53 const exprt &src,
54 std::set<symbol_exprt> &dest);
55
57std::set<symbol_exprt> find_symbols(const exprt &src);
58
60std::unordered_set<irep_idt> find_symbol_identifiers(const exprt &src);
61
63bool has_symbol(
64 const exprt &src,
65 const find_symbols_sett &symbols);
66
68 const typet &src,
70
72 const exprt &src,
74
76 const typet &src,
78
80 const exprt &src,
82
84 const typet &src,
86
88 const exprt &src,
90
91#endif // CPROVER_UTIL_FIND_SYMBOLS_H
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:564
Base class for all expressions.
Definition expr.h:54
Expression to hold a symbol (variable)
Definition std_expr.h:80
The type of an expression, extends irept.
Definition type.h:29
void find_symbols(const exprt &src, find_symbols_sett &dest, bool current, bool next)
Add to the set dest the sub-expressions of src with id ID_symbol if current is true,...
void find_non_pointer_type_symbols(const typet &src, find_symbols_sett &dest)
std::unordered_set< irep_idt > find_symbols_sett
void find_type_and_expr_symbols(const typet &src, find_symbols_sett &dest)
bool has_symbol(const exprt &src, const find_symbols_sett &symbols)
void find_symbols_or_nexts(const exprt &src, find_symbols_sett &dest)
Add to the set dest the sub-expressions of src with id ID_symbol or ID_next_symbol.
std::unordered_set< irep_idt > find_symbol_identifiers(const exprt &src)
Find identifiers of the sub expressions with id ID_symbol.
void find_type_symbols(const typet &src, find_symbols_sett &dest)