Skip to content

Commit fa35841

Browse files
Joel Allredtautschnig
Joel Allred
authored andcommitted
const refs and clean up
Corrections on PR 675 requested by Peter Schrammel
1 parent a31a4eb commit fa35841

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

src/goto-programs/string_refine_preprocess.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -809,11 +809,13 @@ void string_refine_preprocesst::make_string_function_side_effect(
809809
const irep_idt &function_name,
810810
const std::string &signature)
811811
{
812+
// Cannot use const & here
812813
code_function_callt function_call=to_code_function_call(target->code);
813814
source_locationt loc=function_call.source_location();
814815
std::list<code_assignt> assignments;
815-
exprt lhs=function_call.lhs();
816-
exprt s=function_call.arguments()[0];
816+
const exprt &lhs=function_call.lhs();
817+
assert(!function_call.arguments().empty());
818+
const exprt &s=function_call.arguments()[0];
817819
code_typet function_type=to_code_type(function_call.type());
818820

819821
function_type.return_type()=s.type();
@@ -901,7 +903,7 @@ void string_refine_preprocesst::make_to_char_array_function(
901903
const code_function_callt &function_call=to_code_function_call(target->code);
902904
source_locationt location=function_call.source_location();
903905

904-
assert(function_call.arguments().size()>=1);
906+
assert(!function_call.arguments().empty());
905907
const exprt &string_argument=function_call.arguments()[0];
906908
assert(is_java_string_pointer_type(string_argument.type()));
907909

@@ -985,7 +987,7 @@ exprt::operandst string_refine_preprocesst::process_arguments(
985987
arg=typecast_exprt(arg, jls_ptr);
986988
}
987989
arg=make_cprover_string_assign(goto_program, target, arg, location);
988-
typet type=ns.follow(arg.type());
990+
const typet &type=ns.follow(arg.type());
989991
if(is_java_char_array_pointer_type(type))
990992
{
991993
arg=make_cprover_char_array_assign(goto_program, target, arg, location);

src/solvers/refinement/string_constraint_generator_main.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,18 @@ string_exprt string_constraint_generatort::get_string_expr(const exprt &expr)
153153
}
154154
}
155155

156+
/*******************************************************************\
157+
158+
Function: string_constraint_generatort::convert_java_string_to_string_exprt
159+
160+
Inputs: a java string
161+
162+
Outputs: a string expression
163+
164+
Purpose: create a new string_exprt as a conversion of a java string
165+
166+
\*******************************************************************/
167+
156168
string_exprt string_constraint_generatort::convert_java_string_to_string_exprt(
157169
const exprt &jls)
158170
{

src/solvers/refinement/string_refinement.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@ class string_refinementt: public bv_refinementt
7070

7171
unsigned initial_loop_bound;
7272

73-
// Is the current model correct
74-
bool concrete_model;
75-
7673
string_constraint_generatort generator;
7774

7875
// Simple constraints that have been given to the solver

0 commit comments

Comments
 (0)