@@ -18,16 +18,16 @@ Date: July 2021
1818#include < util/pointer_predicates.h>
1919
2020assigns_clause_targett::assigns_clause_targett (
21- const exprt &object_ptr ,
21+ const exprt &object ,
2222 code_contractst &contract,
2323 messaget &log_parameter,
2424 const irep_idt &function_id)
25- : pointer_object(pointer_for(object_ptr )),
25+ : pointer_object(pointer_for(object )),
2626 contract(contract),
2727 init_block(),
2828 log(log_parameter),
29- local_target (typet()),
30- target_id(object_ptr .id())
29+ target (typet()),
30+ target_id(object .id())
3131{
3232 INVARIANT (
3333 pointer_object.type ().id () == ID_pointer,
@@ -40,13 +40,12 @@ assigns_clause_targett::assigns_clause_targett(
4040 function_symbol.location ,
4141 function_symbol.mode );
4242
43- local_target = standin_symbol.symbol_expr ();
43+ target = standin_symbol.symbol_expr ();
4444
4545 // 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 ));
4847 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 ));
5049}
5150
5251assigns_clause_targett::~assigns_clause_targett ()
@@ -56,7 +55,7 @@ assigns_clause_targett::~assigns_clause_targett()
5655std::vector<symbol_exprt> assigns_clause_targett::temporary_declarations () const
5756{
5857 std::vector<symbol_exprt> result;
59- result.push_back (local_target );
58+ result.push_back (target );
6059 return result;
6160}
6261
@@ -93,7 +92,7 @@ exprt assigns_clause_targett::alias_expression(const exprt &lhs)
9392
9493 const exprt region_target = plus_exprt (
9594 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 (),
9796 target_offset.type ()),
9897 target_offset);
9998
@@ -107,13 +106,13 @@ exprt assigns_clause_targett::alias_expression(const exprt &lhs)
107106exprt assigns_clause_targett::compatible_expression (
108107 const assigns_clause_targett &called_target)
109108{
110- return same_object (called_target.get_direct_pointer (), local_target );
109+ return same_object (called_target.get_direct_pointer (), target );
111110}
112111
113- goto_programt
114- assigns_clause_targett::havoc_code (source_locationt location) const
112+ goto_programt assigns_clause_targett::havoc_code () const
115113{
116114 goto_programt assigns_havoc;
115+ source_locationt location = pointer_object.source_location ();
117116
118117 exprt lhs = dereference_exprt (pointer_object);
119118 side_effect_expr_nondett rhs (lhs.type (), location);
@@ -141,12 +140,12 @@ assigns_clauset::assigns_clauset(
141140 code_contractst &contract,
142141 const irep_idt function_id,
143142 messaget log_parameter)
144- : assigns_expr (assigns),
143+ : assigns (assigns),
145144 parent(contract),
146145 function_id(function_id),
147146 log(log_parameter)
148147{
149- for (exprt target : assigns_expr .operands ())
148+ for (exprt target : assigns .operands ())
150149 {
151150 add_target (target);
152151 }
@@ -173,13 +172,7 @@ assigns_clause_targett *assigns_clauset::add_target(exprt target)
173172 return new_target;
174173}
175174
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 ()
183176{
184177 goto_programt result;
185178 for (assigns_clause_targett *target : targets)
@@ -193,29 +186,7 @@ goto_programt assigns_clauset::init_block(source_locationt location)
193186 return result;
194187}
195188
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 ()
219190{
220191 goto_programt dead_statements;
221192 for (assigns_clause_targett *target : targets)
@@ -229,12 +200,11 @@ goto_programt assigns_clauset::dead_stmts(
229200 return dead_statements;
230201}
231202
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 ()
236204{
237205 goto_programt havoc_statements;
206+ source_locationt location = assigns.source_location ();
207+
238208 for (assigns_clause_targett *target : targets)
239209 {
240210 // (1) If the assigned target is not a dereference,
@@ -262,7 +232,7 @@ goto_programt assigns_clauset::havoc_code(
262232
263233 // create havoc_statements
264234 for (goto_programt::instructiont instruction :
265- target->havoc_code (location ).instructions )
235+ target->havoc_code ().instructions )
266236 {
267237 havoc_statements.add (std::move (instruction));
268238 }
0 commit comments