@@ -1234,24 +1234,14 @@ codet java_bytecode_convert_methodt::convert_instructions(
1234
1234
results[0 ] = *res;
1235
1235
}
1236
1236
}
1237
- // replace calls to CProver.assume
1238
1237
else if (statement==" invokestatic" &&
1239
1238
id2string (arg0.get (ID_identifier))==
1240
1239
" java::org.cprover.CProver.assume:(Z)V" )
1241
1240
{
1242
1241
const code_typet &code_type=to_code_type (arg0.type ());
1243
1242
INVARIANT (code_type.parameters ().size ()==1 ,
1244
1243
" function expected to have exactly one parameter" );
1245
-
1246
- exprt operand = pop (1 )[0 ];
1247
- // we may need to adjust the type of the argument
1248
- if (operand.type ()!=bool_typet ())
1249
- operand.make_typecast (bool_typet ());
1250
-
1251
- c=code_assumet (operand);
1252
- source_locationt loc=i_it->source_location ;
1253
- loc.set_function (method_id);
1254
- c.add_source_location ()=loc;
1244
+ c = replace_call_to_cprover_assume (i_it->source_location , c);
1255
1245
}
1256
1246
else if (statement==" invokeinterface" ||
1257
1247
statement==" invokespecial" ||
@@ -2176,6 +2166,21 @@ codet java_bytecode_convert_methodt::convert_instructions(
2176
2166
return code;
2177
2167
}
2178
2168
2169
+ codet &java_bytecode_convert_methodt::replace_call_to_cprover_assume (
2170
+ source_locationt location,
2171
+ codet &c)
2172
+ {
2173
+ exprt operand = pop (1 )[0 ];
2174
+ // we may need to adjust the type of the argument
2175
+ if (operand.type () != bool_typet ())
2176
+ operand.make_typecast (bool_typet ());
2177
+
2178
+ c = code_assumet (operand);
2179
+ location.set_function (method_id);
2180
+ c.add_source_location () = location;
2181
+ return c;
2182
+ }
2183
+
2179
2184
void java_bytecode_convert_methodt::convert_checkcast (
2180
2185
const exprt &arg0,
2181
2186
const exprt::operandst &op,
0 commit comments