@@ -18,16 +18,16 @@ Date: July 2021
18
18
#include < util/pointer_predicates.h>
19
19
20
20
assigns_clause_targett::assigns_clause_targett (
21
- const exprt &object_ptr ,
21
+ const exprt &object ,
22
22
code_contractst &contract,
23
23
messaget &log_parameter,
24
24
const irep_idt &function_id)
25
- : pointer_object(pointer_for(object_ptr )),
25
+ : pointer_object(pointer_for(object )),
26
26
contract(contract),
27
27
init_block(),
28
28
log(log_parameter),
29
- local_target (typet()),
30
- target_id(object_ptr .id())
29
+ target (typet()),
30
+ target_id(object .id())
31
31
{
32
32
INVARIANT (
33
33
pointer_object.type ().id () == ID_pointer,
@@ -40,13 +40,12 @@ assigns_clause_targett::assigns_clause_targett(
40
40
function_symbol.location ,
41
41
function_symbol.mode );
42
42
43
- local_target = standin_symbol.symbol_expr ();
43
+ target = standin_symbol.symbol_expr ();
44
44
45
45
// Build standin variable initialization block
46
- init_block.add (
47
- goto_programt::make_decl (local_target, function_symbol.location ));
46
+ init_block.add (goto_programt::make_decl (target, function_symbol.location ));
48
47
init_block.add (goto_programt::make_assignment (
49
- code_assignt (local_target , pointer_object), function_symbol.location ));
48
+ code_assignt (target , pointer_object), function_symbol.location ));
50
49
}
51
50
52
51
assigns_clause_targett::~assigns_clause_targett ()
@@ -56,7 +55,7 @@ assigns_clause_targett::~assigns_clause_targett()
56
55
std::vector<symbol_exprt> assigns_clause_targett::temporary_declarations () const
57
56
{
58
57
std::vector<symbol_exprt> result;
59
- result.push_back (local_target );
58
+ result.push_back (target );
60
59
return result;
61
60
}
62
61
@@ -93,7 +92,7 @@ exprt assigns_clause_targett::alias_expression(const exprt &lhs)
93
92
94
93
const exprt region_target = plus_exprt (
95
94
typecast_exprt::conditional_cast (
96
- size_of_expr (dereference_exprt (local_target ).type (), contract.ns ).value (),
95
+ size_of_expr (dereference_exprt (target ).type (), contract.ns ).value (),
97
96
target_offset.type ()),
98
97
target_offset);
99
98
@@ -107,13 +106,13 @@ exprt assigns_clause_targett::alias_expression(const exprt &lhs)
107
106
exprt assigns_clause_targett::compatible_expression (
108
107
const assigns_clause_targett &called_target)
109
108
{
110
- return same_object (called_target.get_direct_pointer (), local_target );
109
+ return same_object (called_target.get_direct_pointer (), target );
111
110
}
112
111
113
- goto_programt
114
- assigns_clause_targett::havoc_code (source_locationt location) const
112
+ goto_programt assigns_clause_targett::havoc_code () const
115
113
{
116
114
goto_programt assigns_havoc;
115
+ source_locationt location = pointer_object.source_location ();
117
116
118
117
exprt lhs = dereference_exprt (pointer_object);
119
118
side_effect_expr_nondett rhs (lhs.type (), location);
@@ -141,12 +140,12 @@ assigns_clauset::assigns_clauset(
141
140
code_contractst &contract,
142
141
const irep_idt function_id,
143
142
messaget log_parameter)
144
- : assigns_expr (assigns),
143
+ : assigns (assigns),
145
144
parent(contract),
146
145
function_id(function_id),
147
146
log(log_parameter)
148
147
{
149
- for (exprt target : assigns_expr .operands ())
148
+ for (exprt target : assigns .operands ())
150
149
{
151
150
add_target (target);
152
151
}
@@ -173,13 +172,7 @@ assigns_clause_targett *assigns_clauset::add_target(exprt target)
173
172
return new_target;
174
173
}
175
174
176
- assigns_clause_targett *
177
- assigns_clauset::add_pointer_target (exprt current_operation)
178
- {
179
- return add_target (dereference_exprt (current_operation));
180
- }
181
-
182
- goto_programt assigns_clauset::init_block (source_locationt location)
175
+ goto_programt assigns_clauset::init_block ()
183
176
{
184
177
goto_programt result;
185
178
for (assigns_clause_targett *target : targets)
@@ -193,29 +186,7 @@ goto_programt assigns_clauset::init_block(source_locationt location)
193
186
return result;
194
187
}
195
188
196
- goto_programt &assigns_clauset::temporary_declarations (
197
- source_locationt location,
198
- irep_idt function_name,
199
- irep_idt language_mode)
200
- {
201
- if (standin_declarations.empty ())
202
- {
203
- for (assigns_clause_targett *target : targets)
204
- {
205
- for (symbol_exprt symbol : target->temporary_declarations ())
206
- {
207
- standin_declarations.add (
208
- goto_programt::make_decl (symbol, symbol.source_location ()));
209
- }
210
- }
211
- }
212
- return standin_declarations;
213
- }
214
-
215
- goto_programt assigns_clauset::dead_stmts (
216
- source_locationt location,
217
- irep_idt function_name,
218
- irep_idt language_mode)
189
+ goto_programt assigns_clauset::dead_stmts ()
219
190
{
220
191
goto_programt dead_statements;
221
192
for (assigns_clause_targett *target : targets)
@@ -229,12 +200,11 @@ goto_programt assigns_clauset::dead_stmts(
229
200
return dead_statements;
230
201
}
231
202
232
- goto_programt assigns_clauset::havoc_code (
233
- source_locationt location,
234
- irep_idt function_name,
235
- irep_idt language_mode)
203
+ goto_programt assigns_clauset::havoc_code ()
236
204
{
237
205
goto_programt havoc_statements;
206
+ source_locationt location = assigns.source_location ();
207
+
238
208
for (assigns_clause_targett *target : targets)
239
209
{
240
210
// (1) If the assigned target is not a dereference,
@@ -262,7 +232,7 @@ goto_programt assigns_clauset::havoc_code(
262
232
263
233
// create havoc_statements
264
234
for (goto_programt::instructiont instruction :
265
- target->havoc_code (location ).instructions )
235
+ target->havoc_code ().instructions )
266
236
{
267
237
havoc_statements.add (std::move (instruction));
268
238
}
0 commit comments