Skip to content

Commit 5871906

Browse files
authored
Merge pull request #4607 from allredj/cleanup/arraypool
Cleanup string solver: use same name for arraypool arg everywhere [TG-7439]
2 parents 07d923a + aabac84 commit 5871906

File tree

5 files changed

+28
-28
lines changed

5 files changed

+28
-28
lines changed

src/solvers/strings/array_pool.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ array_string_exprt of_argument(array_poolt &array_pool, const exprt &arg)
129129
return array_pool.find(string_argument.op1(), string_argument.op0());
130130
}
131131

132-
array_string_exprt get_string_expr(array_poolt &pool, const exprt &expr)
132+
array_string_exprt get_string_expr(array_poolt &array_pool, const exprt &expr)
133133
{
134134
PRECONDITION(is_refined_string_type(expr.type()));
135135
const refined_string_exprt &str = to_string_expr(expr);
136-
return pool.find(str.content(), str.length());
136+
return array_pool.find(str.content(), str.length());
137137
}

src/solvers/strings/array_pool.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ class array_poolt final
9898
array_string_exprt of_argument(array_poolt &array_pool, const exprt &arg);
9999

100100
/// Fetch the string_exprt corresponding to the given refined_string_exprt
101-
/// \param pool: pool of arrays representing strings
101+
/// \param array_pool: pool of arrays representing strings
102102
/// \param expr: an expression of refined string type
103103
/// \return a string expression
104-
array_string_exprt get_string_expr(array_poolt &pool, const exprt &expr);
104+
array_string_exprt get_string_expr(array_poolt &array_pool, const exprt &expr);
105105

106106
#endif // CPROVER_SOLVERS_STRINGS_ARRAY_POOL_H

src/solvers/strings/string_constraint_generator.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,23 +141,23 @@ std::pair<exprt, string_constraintst> add_axioms_for_char_at(
141141
std::pair<exprt, string_constraintst> add_axioms_for_code_point_at(
142142
symbol_generatort &fresh_symbol,
143143
const function_application_exprt &f,
144-
array_poolt &pool);
144+
array_poolt &array_pool);
145145
std::pair<exprt, string_constraintst> add_axioms_for_code_point_before(
146146
symbol_generatort &fresh_symbol,
147147
const function_application_exprt &f,
148-
array_poolt &pool);
148+
array_poolt &array_pool);
149149
std::pair<exprt, string_constraintst> add_axioms_for_contains(
150150
symbol_generatort &fresh_symbol,
151151
const function_application_exprt &f,
152152
array_poolt &array_pool);
153153
std::pair<exprt, string_constraintst> add_axioms_for_equals(
154154
symbol_generatort &fresh_symbol,
155155
const function_application_exprt &f,
156-
array_poolt &pool);
156+
array_poolt &array_pool);
157157
std::pair<exprt, string_constraintst> add_axioms_for_equals_ignore_case(
158158
symbol_generatort &fresh_symbol,
159159
const function_application_exprt &f,
160-
array_poolt &pool);
160+
array_poolt &array_pool);
161161

162162
std::pair<exprt, string_constraintst> add_axioms_for_is_empty(
163163
symbol_generatort &fresh_symbol,
@@ -231,7 +231,7 @@ std::pair<exprt, string_constraintst> add_axioms_for_format(
231231
std::pair<exprt, string_constraintst> add_axioms_for_insert(
232232
symbol_generatort &fresh_symbol,
233233
const function_application_exprt &f,
234-
array_poolt &pool);
234+
array_poolt &array_pool);
235235
std::pair<exprt, string_constraintst> add_axioms_for_insert_int(
236236
symbol_generatort &fresh_symbol,
237237
const function_application_exprt &f,
@@ -402,7 +402,7 @@ DEPRECATED(SINCE(2017, 10, 5, "Java specific, should be implemented in Java"))
402402
std::pair<exprt, string_constraintst> add_axioms_for_code_point_count(
403403
symbol_generatort &fresh_symbol,
404404
const function_application_exprt &f,
405-
array_poolt &pool);
405+
array_poolt &array_pool);
406406

407407
/// Add axioms corresponding the String.offsetByCodePointCount java function
408408
/// \todo This function is underspecified, it should return the index within

src/solvers/strings/string_constraint_generator_comparison.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,19 @@ Author: Romain Brenguier, [email protected]
2727
/// \param fresh_symbol: generator of fresh symbols
2828
/// \param f: function application with arguments refined_string `s1` and
2929
/// refined_string `s2`
30-
/// \param pool: pool of arrays representing strings
30+
/// \param array_pool: pool of arrays representing strings
3131
/// \return Boolean expression `eq`
3232
std::pair<exprt, string_constraintst> add_axioms_for_equals(
3333
symbol_generatort &fresh_symbol,
3434
const function_application_exprt &f,
35-
array_poolt &pool)
35+
array_poolt &array_pool)
3636
{
3737
PRECONDITION(f.type() == bool_typet() || f.type().id() == ID_c_bool);
3838
PRECONDITION(f.arguments().size() == 2);
3939

4040
string_constraintst constraints;
41-
array_string_exprt s1 = get_string_expr(pool, f.arguments()[0]);
42-
array_string_exprt s2 = get_string_expr(pool, f.arguments()[1]);
41+
array_string_exprt s1 = get_string_expr(array_pool, f.arguments()[0]);
42+
array_string_exprt s2 = get_string_expr(array_pool, f.arguments()[1]);
4343
symbol_exprt eq = fresh_symbol("equal");
4444
typecast_exprt tc_eq(eq, f.type());
4545

@@ -128,19 +128,19 @@ static exprt character_equals_ignore_case(
128128
/// \param fresh_symbol: generator of fresh symbols
129129
/// \param f: function application with arguments refined_string `s1` and
130130
/// refined_string `s2`
131-
/// \param pool: pool of arrays representing strings
131+
/// \param array_pool: pool of arrays representing strings
132132
/// \return Boolean expression `eq`
133133
std::pair<exprt, string_constraintst> add_axioms_for_equals_ignore_case(
134134
symbol_generatort &fresh_symbol,
135135
const function_application_exprt &f,
136-
array_poolt &pool)
136+
array_poolt &array_pool)
137137
{
138138
PRECONDITION(f.type() == bool_typet() || f.type().id() == ID_c_bool);
139139
PRECONDITION(f.arguments().size() == 2);
140140
string_constraintst constraints;
141141
const symbol_exprt eq = fresh_symbol("equal_ignore_case");
142-
const array_string_exprt s1 = get_string_expr(pool, f.arguments()[0]);
143-
const array_string_exprt s2 = get_string_expr(pool, f.arguments()[1]);
142+
const array_string_exprt s1 = get_string_expr(array_pool, f.arguments()[0]);
143+
const array_string_exprt s2 = get_string_expr(array_pool, f.arguments()[1]);
144144
const typet char_type = s1.content().type().subtype();
145145
const exprt char_a = from_integer('a', char_type);
146146
const exprt char_A = from_integer('A', char_type);
@@ -233,19 +233,19 @@ string_constraint_generatort::add_axioms_for_hash_code(
233233
/// \param fresh_symbol: generator of fresh symbols
234234
/// \param f: function application with arguments refined_string `s1` and
235235
/// refined_string `s2`
236-
/// \param pool: pool of arrays representing strings
236+
/// \param array_pool: pool of arrays representing strings
237237
/// \return integer expression `res`
238238
std::pair<exprt, string_constraintst> add_axioms_for_compare_to(
239239
symbol_generatort &fresh_symbol,
240240
const function_application_exprt &f,
241-
array_poolt &pool)
241+
array_poolt &array_pool)
242242
{
243243
PRECONDITION(f.arguments().size() == 2);
244244
const typet &return_type = f.type();
245245
PRECONDITION(return_type.id() == ID_signedbv);
246246
string_constraintst constraints;
247-
const array_string_exprt &s1 = get_string_expr(pool, f.arguments()[0]);
248-
const array_string_exprt &s2 = get_string_expr(pool, f.arguments()[1]);
247+
const array_string_exprt &s1 = get_string_expr(array_pool, f.arguments()[0]);
248+
const array_string_exprt &s2 = get_string_expr(array_pool, f.arguments()[1]);
249249
const symbol_exprt res = fresh_symbol("compare_to", return_type);
250250
const typet &index_type = s1.length().type();
251251

src/solvers/strings/string_constraint_generator_insert.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,18 +100,18 @@ exprt length_constraint_for_insert(
100100
/// \param f: function application with arguments integer `|res|`, character
101101
/// pointer `&res[0]`, refined_string `s1`, refined_string`s2`, integer
102102
/// `offset`, optional integer `start` and optional integer `end`
103-
/// \param pool: pool of arrays representing strings
103+
/// \param array_pool: pool of arrays representing strings
104104
/// \return an integer expression which is different from zero if there is an
105105
/// exception to signal
106106
std::pair<exprt, string_constraintst> add_axioms_for_insert(
107107
symbol_generatort &fresh_symbol,
108108
const function_application_exprt &f,
109-
array_poolt &pool)
109+
array_poolt &array_pool)
110110
{
111111
PRECONDITION(f.arguments().size() == 5 || f.arguments().size() == 7);
112-
array_string_exprt s1 = get_string_expr(pool, f.arguments()[2]);
113-
array_string_exprt s2 = get_string_expr(pool, f.arguments()[4]);
114-
array_string_exprt res = pool.find(f.arguments()[1], f.arguments()[0]);
112+
array_string_exprt s1 = get_string_expr(array_pool, f.arguments()[2]);
113+
array_string_exprt s2 = get_string_expr(array_pool, f.arguments()[4]);
114+
array_string_exprt res = array_pool.find(f.arguments()[1], f.arguments()[0]);
115115
const exprt &offset = f.arguments()[3];
116116
if(f.arguments().size() == 7)
117117
{
@@ -120,7 +120,7 @@ std::pair<exprt, string_constraintst> add_axioms_for_insert(
120120
const typet &char_type = s1.content().type().subtype();
121121
const typet &index_type = s1.length().type();
122122
const array_string_exprt substring =
123-
pool.fresh_string(index_type, char_type);
123+
array_pool.fresh_string(index_type, char_type);
124124
return combine_results(
125125
add_axioms_for_substring(fresh_symbol, substring, s2, start, end),
126126
add_axioms_for_insert(fresh_symbol, res, s1, substring, offset));

0 commit comments

Comments
 (0)