@@ -121,26 +121,6 @@ static bool is_typecast_with_id(const exprt& expr, const irep_idt& identifier)
121
121
return op_symbol.get_identifier ()==identifier;
122
122
}
123
123
124
- // / Return whether the instruction is an assignment, and the rhs is a symbol or
125
- // / typecast expression with the specified identifier.
126
- // / \param instr: A goto program instruction.
127
- // / \param identifier: Some identifier.
128
- // / \return True if the expression is a typecast with one operand, and the
129
- // / typecast's identifier matches the specified identifier.
130
- static bool is_assignment_from (
131
- const goto_programt::instructiont &instr,
132
- const irep_idt &identifier)
133
- {
134
- // If not an assignment, return false
135
- if (!instr.is_assign ())
136
- {
137
- return false ;
138
- }
139
- const auto &rhs=to_code_assign (instr.code ).rhs ();
140
- return is_symbol_with_id (rhs, identifier) ||
141
- is_typecast_with_id (rhs, identifier);
142
- }
143
-
144
124
// / Given an iterator into a list of instructions, modify the list to replace
145
125
// / 'nondet' library functions with CBMC-native nondet expressions, and return
146
126
// / an iterator to the next instruction to check.
@@ -170,30 +150,17 @@ static goto_programt::targett check_and_replace_target(
170
150
{
171
151
return next_instr;
172
152
}
173
- const auto return_identifier=
174
- to_symbol_expr (next_instr_assign_lhs).get_identifier ();
175
153
176
154
auto &instructions=goto_program.instructions ;
177
155
const auto end=instructions.end ();
178
156
179
- // Look for an instruction where this name is on the RHS of an assignment
180
- const auto matching_assignment=std::find_if (
181
- next_instr,
182
- end,
183
- [&return_identifier](const goto_programt::instructiont &instr)
184
- {
185
- return is_assignment_from (instr, return_identifier);
186
- });
187
-
188
- assert (matching_assignment!=end);
189
-
190
157
// Assume that the LHS of *this* assignment is the actual nondet variable
191
- const auto &code_assign=to_code_assign (matching_assignment ->code );
158
+ const auto &code_assign=to_code_assign (next_instr ->code );
192
159
const auto nondet_var=code_assign.lhs ();
193
160
const auto source_loc=target->source_location ;
194
161
195
162
// Erase from the nondet function call to the assignment
196
- const auto after_matching_assignment=std::next (matching_assignment );
163
+ const auto after_matching_assignment=std::next (next_instr );
197
164
assert (after_matching_assignment!=end);
198
165
199
166
std::for_each (
0 commit comments