Skip to content

Commit 04439ce

Browse files
author
Daniel Kroening
committed
replace instances of to_unsigned_integer by numeric_cast
1 parent 23ecbe8 commit 04439ce

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
@@ -1065,8 +1065,9 @@ codet java_bytecode_convert_methodt::convert_instructions(
10651065
{
10661066
PRECONDITION(!i_it->args.empty());
10671067

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

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

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)