@@ -7,6 +7,7 @@ Author: Diffblue Ltd.
7
7
\*******************************************************************/
8
8
9
9
#include " nondet.h"
10
+ #include " allocate_objects.h"
10
11
11
12
#include < util/arith_tools.h>
12
13
#include < util/c_types.h>
@@ -16,25 +17,17 @@ Author: Diffblue Ltd.
16
17
symbol_exprt generate_nondet_int (
17
18
const exprt &min_value_expr,
18
19
const exprt &max_value_expr,
19
- const std::string &name_prefix,
20
20
const std::string &basename_prefix,
21
- const irep_idt &mode,
22
21
const source_locationt &source_location,
23
- symbol_table_baset &symbol_table ,
22
+ allocate_objectst &allocate_objects ,
24
23
code_blockt &instructions)
25
24
{
26
25
PRECONDITION (min_value_expr.type () == max_value_expr.type ());
27
26
const typet &int_type = min_value_expr.type ();
28
27
29
28
// Declare a symbol for the non deterministic integer.
30
- const symbol_exprt &nondet_symbol = get_fresh_aux_symbol (
31
- int_type,
32
- name_prefix,
33
- basename_prefix,
34
- source_location,
35
- mode,
36
- symbol_table)
37
- .symbol_expr ();
29
+ const symbol_exprt &nondet_symbol =
30
+ allocate_objects.allocate_automatic_local_object (int_type, basename_prefix);
38
31
instructions.add (code_declt (nondet_symbol));
39
32
40
33
// Assign the symbol any non deterministic integer value.
@@ -58,23 +51,19 @@ symbol_exprt generate_nondet_int(
58
51
symbol_exprt generate_nondet_int (
59
52
const mp_integer &min_value,
60
53
const mp_integer &max_value,
61
- const std::string &name_prefix,
62
54
const std::string &basename_prefix,
63
55
const typet &int_type,
64
- const irep_idt &mode,
65
56
const source_locationt &source_location,
66
- symbol_table_baset &symbol_table ,
57
+ allocate_objectst &allocate_objects ,
67
58
code_blockt &instructions)
68
59
{
69
60
PRECONDITION (min_value < max_value);
70
61
return generate_nondet_int (
71
62
from_integer (min_value, int_type),
72
63
from_integer (max_value, int_type),
73
- name_prefix,
74
64
basename_prefix,
75
- mode,
76
65
source_location,
77
- symbol_table ,
66
+ allocate_objects ,
78
67
instructions);
79
68
}
80
69
@@ -93,15 +82,16 @@ code_blockt generate_nondet_switch(
93
82
94
83
code_blockt result_block;
95
84
85
+ allocate_objectst allocate_objects (
86
+ mode, source_location, name_prefix, symbol_table);
87
+
96
88
const symbol_exprt &switch_value = generate_nondet_int (
97
89
0 ,
98
90
switch_cases.size () - 1 ,
99
- id2string (name_prefix),
100
91
" nondet_int" ,
101
92
int_type,
102
- mode,
103
93
source_location,
104
- symbol_table ,
94
+ allocate_objects ,
105
95
result_block);
106
96
107
97
code_blockt switch_block;
0 commit comments