CBMC
find_symbols.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module:
4 
5 Author: 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 "irep.h"
14 
15 #include <algorithm>
16 #include <set>
17 #include <unordered_set>
18 
19 class exprt;
20 class symbol_exprt;
21 class typet;
22 
23 typedef std::unordered_set<irep_idt> find_symbols_sett;
24 
28 bool has_symbol_expr(
29  const exprt &src,
30  const irep_idt &identifier,
31  bool include_bound_symbols);
32 
35 void find_symbols(const exprt &src, find_symbols_sett &dest);
36 
39 void find_symbols(
40  const exprt &src,
41  std::set<symbol_exprt> &dest);
42 
45 inline std::set<symbol_exprt> find_symbols(const exprt &src)
46 {
47  std::set<symbol_exprt> syms;
48  find_symbols(src, syms);
49  return syms;
50 }
51 
55 {
56  find_symbols_sett identifiers;
57  find_symbols(src, identifiers);
58  return identifiers;
59 }
60 
63  const typet &src,
64  find_symbols_sett &dest);
65 
68  const exprt &src,
69  find_symbols_sett &dest);
70 
74  const typet &src,
75  find_symbols_sett &dest);
76 
80  const exprt &src,
81  find_symbols_sett &dest);
82 
86  const typet &src,
87  find_symbols_sett &dest);
88 
92  const exprt &src,
93  find_symbols_sett &dest);
94 
95 #endif // CPROVER_UTIL_FIND_SYMBOLS_H
dstringt
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition: dstring.h:36
typet
The type of an expression, extends irept.
Definition: type.h:28
exprt
Base class for all expressions.
Definition: expr.h:55
symbol_exprt
Expression to hold a symbol (variable)
Definition: std_expr.h:112
find_symbols
void find_symbols(const exprt &src, find_symbols_sett &dest)
Add to the set dest the sub-expressions of src with id ID_symbol, for both free and bound variables.
Definition: find_symbols.cpp:299
has_symbol_expr
bool has_symbol_expr(const exprt &src, const irep_idt &identifier, bool include_bound_symbols)
Returns true if one of the symbol expressions in src has identifier identifier; if include_bound_symb...
Definition: find_symbols.cpp:232
find_type_symbols
void find_type_symbols(const typet &src, find_symbols_sett &dest)
Collect all type tags contained in src and add them to dest.
Definition: find_symbols.cpp:253
find_symbol_identifiers
find_symbols_sett find_symbol_identifiers(const exprt &src)
Find identifiers of the sub expressions with id ID_symbol, considering both free and bound variables.
Definition: find_symbols.h:54
find_symbols_sett
std::unordered_set< irep_idt > find_symbols_sett
Definition: find_symbols.h:21
find_type_and_expr_symbols
void find_type_and_expr_symbols(const typet &src, find_symbols_sett &dest)
Find identifiers of the sub expressions with id ID_symbol, considering both free and bound variables,...
Definition: find_symbols.cpp:291
find_non_pointer_type_symbols
void find_non_pointer_type_symbols(const typet &src, find_symbols_sett &dest)
Collect type tags contained in src when the expression of such a type is not a pointer,...
Definition: find_symbols.cpp:272
irep.h