Skip to content

Commit 66090da

Browse files
author
Daniel Kroening
committed
replace instances of to_unsigned_integer by numeric_cast
1 parent e082aed commit 66090da

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

jbmc/src/java_bytecode/java_bytecode_convert_method.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,8 +1066,9 @@ codet java_bytecode_convert_methodt::convert_instructions(
10661066
{
10671067
PRECONDITION(!i_it->args.empty());
10681068

1069-
auto target=numeric_cast<unsigned>(to_constant_expr(i_it->args[0]));
1070-
DATA_INVARIANT(target.has_value(), "target expected to be unsigned integer");
1069+
auto target = numeric_cast<unsigned>(to_constant_expr(i_it->args[0]));
1070+
DATA_INVARIANT(
1071+
target.has_value(), "target expected to be unsigned integer");
10711072
targets.insert(target.value());
10721073

10731074
a_entry.first->second.successors.push_back(target.value());
@@ -1090,8 +1091,9 @@ codet java_bytecode_convert_methodt::convert_instructions(
10901091
{
10911092
if(is_label)
10921093
{
1093-
auto target=numeric_cast<unsigned>(to_constant_expr(arg));
1094-
DATA_INVARIANT(target.has_value(), "target expected to be unsigned integer");
1094+
auto target = numeric_cast<unsigned>(to_constant_expr(arg));
1095+
DATA_INVARIANT(
1096+
target.has_value(), "target expected to be unsigned integer");
10951097
targets.insert(target.value());
10961098
a_entry.first->second.successors.push_back(target.value());
10971099
}

jbmc/src/java_bytecode/java_local_variable_table.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,9 @@ static bool is_store_to_slot(
193193
{
194194
// Store with an argument:
195195
const auto &arg=inst.args[0];
196-
auto v=numeric_cast<unsigned>(to_constant_expr(arg));
196+
auto v = numeric_cast<unsigned>(to_constant_expr(arg));
197197
CHECK_RETURN(v.has_value());
198-
storeslotidx=v.value();
198+
storeslotidx = v.value();
199199
}
200200
else
201201
{

src/solvers/refinement/string_constraint_generator_format.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -486,9 +486,9 @@ utf16_constant_array_to_java(const array_exprt &arr, std::size_t length)
486486
for(std::size_t i=0; i<arr.operands().size() && i<length; i++)
487487
{
488488
PRECONDITION(arr.operands()[i].id()==ID_constant);
489-
auto c=numeric_cast<unsigned>(to_constant_expr(arr.operands()[i]));
489+
auto c = numeric_cast<unsigned>(to_constant_expr(arr.operands()[i]));
490490
INVARIANT(c.has_value(), "constant should be convertible to unsigned");
491-
out[i]=c.value();
491+
out[i] = c.value();
492492
}
493493
return utf16_native_endian_to_java(out);
494494
}
@@ -519,10 +519,10 @@ std::pair<exprt, string_constraintst> add_axioms_for_format(
519519
char_array_of_pointer(array_pool, f.arguments()[1], f.arguments()[0]);
520520
const array_string_exprt s1 = get_string_expr(array_pool, f.arguments()[2]);
521521

522-
if(s1.length().id()==ID_constant &&
523-
s1.content().id()==ID_array)
522+
if(s1.length().id() == ID_constant && s1.content().id() == ID_array)
524523
{
525-
const auto length=numeric_cast_v<std::size_t>(to_constant_expr(s1.length()));
524+
const auto length =
525+
numeric_cast_v<std::size_t>(to_constant_expr(s1.length()));
526526
std::string s=utf16_constant_array_to_java(
527527
to_array_expr(s1.content()), length);
528528
// List of arguments after s

0 commit comments

Comments
 (0)