Skip to content

Commit 91759a4

Browse files
committed
Remove symbol generator from add_axioms_for_* that do not use it
The fresh_symbol parameter was never used in these functions and is thus removed.
1 parent 33ec17e commit 91759a4

7 files changed

+8
-23
lines changed

src/solvers/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ allocates a new string before calling a primitive.
221221
\copybrief add_axioms_for_char_at(symbol_generatort &fresh_symbol, const function_application_exprt &f, array_poolt &array_pool)
222222
\link add_axioms_for_char_at More... \endlink
223223
* `cprover_string_length` :
224-
\copybrief add_axioms_for_length(symbol_generatort &fresh_symbol,const function_application_exprt &f, array_poolt &array_pool)
224+
\copybrief add_axioms_for_length(const function_application_exprt &f, array_poolt &array_pool)
225225
\link add_axioms_for_length More... \endlink
226226

227227
\subsection comparisons Comparisons:

src/solvers/refinement/string_constraint_generator.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,9 @@ std::pair<exprt, string_constraintst> add_axioms_for_is_suffix(
267267
bool swap_arguments,
268268
array_poolt &array_pool);
269269
std::pair<exprt, string_constraintst> add_axioms_for_length(
270-
symbol_generatort &fresh_symbol,
271270
const function_application_exprt &f,
272271
array_poolt &array_pool);
273272
std::pair<exprt, string_constraintst> add_axioms_for_empty_string(
274-
symbol_generatort &fresh_symbol,
275273
const function_application_exprt &f);
276274

277275
std::pair<exprt, string_constraintst> add_axioms_for_copy(
@@ -438,7 +436,6 @@ std::pair<exprt, string_constraintst> add_axioms_for_string_of_float(
438436
array_poolt &array_pool,
439437
const namespacet &ns);
440438
std::pair<exprt, string_constraintst> add_axioms_for_fractional_part(
441-
symbol_generatort &fresh_symbol,
442439
const array_string_exprt &res,
443440
const exprt &i,
444441
size_t max_size);
@@ -491,11 +488,9 @@ std::pair<exprt, string_constraintst> add_axioms_for_trim(
491488
array_poolt &array_pool);
492489

493490
std::pair<exprt, string_constraintst> add_axioms_for_code_point(
494-
symbol_generatort &fresh_symbol,
495491
const array_string_exprt &res,
496492
const exprt &code_point);
497493
std::pair<exprt, string_constraintst> add_axioms_for_char_literal(
498-
symbol_generatort &fresh_symbol,
499494
const function_application_exprt &f);
500495

501496
/// Add axioms corresponding the String.codePointCount java function

src/solvers/refinement/string_constraint_generator_code_points.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@ Author: Romain Brenguier, [email protected]
1414

1515
/// add axioms for the conversion of an integer representing a java
1616
/// code point to a utf-16 string
17-
/// \param fresh_symbol: generator of fresh symbols
1817
/// \param res: array of characters corresponding to the result fo the function
1918
/// \param code_point: an expression representing a java code point
2019
/// \return integer expression equal to zero
2120
std::pair<exprt, string_constraintst> add_axioms_for_code_point(
22-
symbol_generatort &fresh_symbol,
2321
const array_string_exprt &res,
2422
const exprt &code_point)
2523
{

src/solvers/refinement/string_constraint_generator_concat.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,6 @@ std::pair<exprt, string_constraintst> add_axioms_for_concat_code_point(
154154
const array_string_exprt code_point =
155155
array_pool.fresh_string(index_type, char_type);
156156
return combine_results(
157-
add_axioms_for_code_point(fresh_symbol, code_point, f.arguments()[3]),
157+
add_axioms_for_code_point(code_point, f.arguments()[3]),
158158
add_axioms_for_concat(fresh_symbol, res, s1, code_point));
159159
}

src/solvers/refinement/string_constraint_generator_constants.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,10 @@ std::pair<exprt, string_constraintst> add_axioms_for_constant(
5757
}
5858

5959
/// Add axioms to say that the returned string expression is empty
60-
/// \param fresh_symbol: generator of fresh symbols
6160
/// \param f: function application with arguments integer `length` and character
6261
/// pointer `ptr`.
6362
/// \return integer expression equal to zero
6463
std::pair<exprt, string_constraintst> add_axioms_for_empty_string(
65-
symbol_generatort &fresh_symbol,
6664
const function_application_exprt &f)
6765
{
6866
PRECONDITION(f.arguments().size() == 2);

src/solvers/refinement/string_constraint_generator_float.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,8 @@ std::pair<exprt, string_constraintst> add_axioms_for_string_of_float(
221221
const mod_exprt fractional_part(shifted, max_non_exponent_notation);
222222
const array_string_exprt fractional_part_str =
223223
array_pool.fresh_string(index_type, char_type);
224-
auto result1 = add_axioms_for_fractional_part(
225-
fresh_symbol, fractional_part_str, fractional_part, 6);
224+
auto result1 =
225+
add_axioms_for_fractional_part(fractional_part_str, fractional_part, 6);
226226

227227
// The axiom added to convert to integer should always be satisfiable even
228228
// when the preconditions are not satisfied.
@@ -247,14 +247,12 @@ std::pair<exprt, string_constraintst> add_axioms_for_string_of_float(
247247

248248
/// Add axioms for representing the fractional part of a floating point starting
249249
/// with a dot
250-
/// \param fresh_symbol: generator of fresh symbols
251250
/// \param res: string expression for the result
252251
/// \param int_expr: an integer expression
253252
/// \param max_size: a maximal size for the string, this includes the
254253
/// potential minus sign and therefore should be greater than 2
255254
/// \return code 0 on success
256255
std::pair<exprt, string_constraintst> add_axioms_for_fractional_part(
257-
symbol_generatort &fresh_symbol,
258256
const array_string_exprt &res,
259257
const exprt &int_expr,
260258
size_t max_size)
@@ -478,7 +476,7 @@ std::pair<exprt, string_constraintst> add_axioms_from_float_scientific_notation(
478476
array_string_exprt string_fractional_part =
479477
array_pool.fresh_string(index_type, char_type);
480478
auto result2 = add_axioms_for_fractional_part(
481-
fresh_symbol, string_fractional_part, fractional_part_shifted, 6);
479+
string_fractional_part, fractional_part_shifted, 6);
482480

483481
// string_expr_with_fractional_part =
484482
// concat(string_with_do, string_fractional_part)

src/solvers/refinement/string_constraint_generator_main.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,9 @@ string_constraint_generatort::add_axioms_for_function_application(
374374
const irep_idt &id = get_function_name(expr);
375375

376376
if(id==ID_cprover_char_literal_func)
377-
return add_axioms_for_char_literal(fresh_symbol, expr);
377+
return add_axioms_for_char_literal(expr);
378378
else if(id==ID_cprover_string_length_func)
379-
return add_axioms_for_length(fresh_symbol, expr, array_pool);
379+
return add_axioms_for_length(expr, array_pool);
380380
else if(id==ID_cprover_string_equal_func)
381381
return add_axioms_for_equals(fresh_symbol, expr, array_pool);
382382
else if(id==ID_cprover_string_equals_ignore_case_func)
@@ -436,7 +436,7 @@ string_constraint_generatort::add_axioms_for_function_application(
436436
else if(id==ID_cprover_string_trim_func)
437437
return add_axioms_for_trim(fresh_symbol, expr, array_pool);
438438
else if(id==ID_cprover_string_empty_string_func)
439-
return add_axioms_for_empty_string(fresh_symbol, expr);
439+
return add_axioms_for_empty_string(expr);
440440
else if(id==ID_cprover_string_copy_func)
441441
return add_axioms_for_copy(fresh_symbol, expr, array_pool);
442442
else if(id==ID_cprover_string_of_int_hex_func)
@@ -507,12 +507,10 @@ std::pair<exprt, string_constraintst> add_axioms_for_copy(
507507
/// Length of a string
508508
///
509509
/// Returns the length of the string argument of the given function application
510-
/// \param fresh_symbol: generator of fresh symbols
511510
/// \param f: function application with argument string `str`
512511
/// \param array_pool: pool of arrays representing strings
513512
/// \return expression `|str|`
514513
std::pair<exprt, string_constraintst> add_axioms_for_length(
515-
symbol_generatort &fresh_symbol,
516514
const function_application_exprt &f,
517515
array_poolt &array_pool)
518516
{
@@ -529,11 +527,9 @@ exprt is_positive(const exprt &x)
529527
}
530528

531529
/// add axioms stating that the returned value is equal to the argument
532-
/// \param fresh_symbol: generator of fresh symbols
533530
/// \param f: function application with one character argument
534531
/// \return a new character expression
535532
std::pair<exprt, string_constraintst> add_axioms_for_char_literal(
536-
symbol_generatort &fresh_symbol,
537533
const function_application_exprt &f)
538534
{
539535
const function_application_exprt::argumentst &args=f.arguments();

0 commit comments

Comments
 (0)