Skip to content

Commit 6ecf65f

Browse files
Joel Allredromainbrenguier
authored andcommitted
Linting corrections to /solvers/refinement/
1 parent 28de886 commit 6ecf65f

File tree

4 files changed

+12
-15
lines changed

4 files changed

+12
-15
lines changed

src/solvers/refinement/string_constraint_generator.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class string_constraint_generatort
9696
const std::size_t MAX_FLOAT_LENGTH=15;
9797
const std::size_t MAX_DOUBLE_LENGTH=30;
9898

99-
std::map<function_application_exprt,exprt> function_application_cache;
99+
std::map<function_application_exprt, exprt> function_application_cache;
100100

101101
static irep_idt extract_java_string(const symbol_exprt &s);
102102

@@ -305,7 +305,6 @@ class string_constraint_generatort
305305
exprt is_low_surrogate(const exprt &chr) const;
306306
exprt character_equals_ignore_case(
307307
exprt char1, exprt char2, exprt char_a, exprt char_A, exprt char_Z);
308-
309308
};
310309

311310
#endif

src/solvers/refinement/string_constraint_generator_comparison.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,8 @@ exprt string_constraint_generatort::add_axioms_for_compare_to(
289289
axioms.push_back(a3);
290290

291291
symbol_exprt i2=fresh_univ_index("QA_compare_to", index_type);
292-
string_constraintt a4(i2, x, not_exprt(res_null), equal_exprt(s1[i2], s2[i2]));
292+
string_constraintt a4(
293+
i2, x, not_exprt(res_null), equal_exprt(s1[i2], s2[i2]));
293294
axioms.push_back(a4);
294295

295296
return res;

src/solvers/refinement/string_constraint_generator_main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ exprt string_constraint_generatort::add_axioms_for_function_application(
381381
function_application_exprt new_expr(expr);
382382
// TODO: This part needs some improvement.
383383
// Stripping the symbol name is not a very robust process.
384-
new_expr.function() = symbol_exprt(str_id.substr(0,pos+4));
384+
new_expr.function() = symbol_exprt(str_id.substr(0, pos+4));
385385
assert(get_mode()==ID_java);
386386
new_expr.type() = refined_string_typet(java_int_type(), java_char_type());
387387

@@ -402,7 +402,7 @@ exprt string_constraint_generatort::add_axioms_for_function_application(
402402
if(pos!=std::string::npos)
403403
{
404404
function_application_exprt new_expr(expr);
405-
new_expr.function() = symbol_exprt(str_id.substr(0,pos+4));
405+
new_expr.function() = symbol_exprt(str_id.substr(0, pos+4));
406406
new_expr.type() = refined_string_typet(java_int_type(), java_char_type());
407407

408408
auto res_it=function_application_cache.insert(std::make_pair(new_expr,

src/solvers/refinement/string_refinement.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Author: Alberto Griggio, alberto.griggio@gmail.com
1616
#include <util/cprover_prefix.h>
1717
#include <util/replace_expr.h>
1818
#include <util/refined_string_type.h>
19-
#include <util/replace_expr.h>
2019
#include <solvers/sat/satcheck.h>
2120
#include <solvers/refinement/string_refinement.h>
2221
#include <langapi/language_util.h>
@@ -126,7 +125,7 @@ void string_refinementt::add_symbol_to_symbol_map
126125
reverse_symbol_resolve[new_rhs].push_back(lhs);
127126

128127
std::list<exprt> symbols_to_update_with_new_rhs(reverse_symbol_resolve[rhs]);
129-
for(exprt item:symbols_to_update_with_new_rhs)
128+
for(exprt item : symbols_to_update_with_new_rhs)
130129
{
131130
symbol_resolve[item]=new_rhs;
132131
reverse_symbol_resolve[new_rhs].push_back(item);
@@ -154,8 +153,8 @@ void string_refinementt::set_char_array_equality(
154153
for(size_t i=0, ilim=rhs.operands().size(); i!=ilim; ++i)
155154
{
156155
// Introduce axioms to map symbolic rhs to its char array.
157-
index_exprt arraycell(rhs, from_integer(i,index_type));
158-
equal_exprt arrayeq(arraycell,rhs.operands()[i]);
156+
index_exprt arraycell(rhs, from_integer(i, index_type));
157+
equal_exprt arrayeq(arraycell, rhs.operands()[i]);
159158
generator.axioms.push_back(arrayeq);
160159
}
161160
}
@@ -503,7 +502,7 @@ exprt string_refinementt::get_array(const exprt &arr, const exprt &size)
503502
}
504503

505504
unsigned n;
506-
if(to_unsigned_integer(to_constant_expr(size), n))
505+
if(to_unsigned_integer(to_constant_expr(size_val), n))
507506
{
508507
debug() << "(sr::get_array) size is not a valid";
509508
return empty_ret;
@@ -524,7 +523,7 @@ exprt string_refinementt::get_array(const exprt &arr, const exprt &size)
524523
return empty_ret;
525524
}
526525

527-
unsigned concrete_array[n];
526+
std::vector<unsigned> concrete_array(n);
528527

529528
if(arr_val.id()=="array-list")
530529
{
@@ -537,7 +536,6 @@ exprt string_refinementt::get_array(const exprt &arr, const exprt &size)
537536
if(idx<n)
538537
{
539538
exprt value=arr_val.operands()[i*2+1];
540-
to_unsigned_integer(to_constant_expr(value), concrete_array[i]);
541539
to_unsigned_integer(to_constant_expr(value), concrete_array[idx]);
542540
}
543541
}
@@ -561,8 +559,7 @@ exprt string_refinementt::get_array(const exprt &arr, const exprt &size)
561559

562560
for(size_t i=0; i<n; i++)
563561
{
564-
unsigned c=concrete_array[i];
565-
exprt c_expr=from_integer(c, char_type);
562+
exprt c_expr=from_integer(concrete_array[i], char_type);
566563
ret.move_to_operands(c_expr);
567564
}
568565

@@ -630,7 +627,7 @@ replace_mapt string_refinementt::fill_model()
630627
{
631628
replace_mapt fmodel;
632629

633-
for(auto it:symbol_resolve)
630+
for(auto it : symbol_resolve)
634631
{
635632
if(refined_string_typet::is_refined_string_type(it.second.type()))
636633
{

0 commit comments

Comments
 (0)