Skip to content

Commit 37aa9cb

Browse files
Apply clang-format suggestions
No function change. The change have been generated automatically by clang-format.
1 parent 57673b7 commit 37aa9cb

File tree

2 files changed

+75
-97
lines changed

2 files changed

+75
-97
lines changed

src/solvers/smt2/smt2_ast.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,11 @@ static std::function<smt2_astt(smt2_astt)> make_function(smt2_astt f)
101101
std::function<smt2_astt(smt2_astt)>
102102
smt2_extract(const mp_integer &width, const mp_integer &offset)
103103
{
104-
return make_function(
105-
smt2_astt::make(
106-
"_",
107-
smt2_astt("extract"),
108-
smt2_astt::integer(width),
109-
smt2_astt::integer(offset)));
104+
return make_function(smt2_astt::make(
105+
"_",
106+
smt2_astt("extract"),
107+
smt2_astt::integer(width),
108+
smt2_astt::integer(offset)));
110109
}
111110

112111
smt2_astt smt2_eq(smt2_astt left, smt2_astt right)

src/solvers/smt2/smt2_conv.cpp

Lines changed: 70 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -871,12 +871,11 @@ smt2_astt smt2_convt::convert_expr(const exprt &expr)
871871
// do bitnot component-by-component
872872
for(mp_integer i=0; i!=size; ++i)
873873
{
874-
bvnot_node.add_child(
874+
bvnot_node.add_child(smt2_astt::make(
875+
"bvnot",
875876
smt2_astt::make(
876-
"bvnot",
877-
smt2_astt::make(
878-
smt_typename + "." + std::to_string((size - i - 1).to_long()),
879-
smt2_astt("?vectorop"))));
877+
smt_typename + "." + std::to_string((size - i - 1).to_long()),
878+
smt2_astt("?vectorop"))));
880879
}
881880

882881
return smt2_let(
@@ -932,12 +931,11 @@ smt2_astt smt2_convt::convert_expr(const exprt &expr)
932931
// negate component-by-component
933932
for(mp_integer i=0; i!=size; ++i)
934933
{
935-
bvneg_node.add_child(
934+
bvneg_node.add_child(smt2_astt::make(
935+
"bvneg",
936936
smt2_astt::make(
937-
"bvneg",
938-
smt2_astt::make(
939-
smt_typename + "." + std::to_string((size - i - 1).to_long()),
940-
smt2_astt("?vectorop"))));
937+
smt_typename + "." + std::to_string((size - i - 1).to_long()),
938+
smt2_astt("?vectorop"))));
941939
}
942940

943941
return smt2_let(
@@ -1319,9 +1317,8 @@ smt2_astt smt2_convt::convert_expr(const exprt &expr)
13191317
{
13201318
typecast_exprt tmp(extractbit_expr.index(), extractbit_expr.src().type());
13211319
return smt2_eq(
1322-
smt2_extract(0, 0)(
1323-
smt2_astt::make(
1324-
"bvlshr", flatten2bv(extractbit_expr.src()), convert_expr(tmp))),
1320+
smt2_extract(0, 0)(smt2_astt::make(
1321+
"bvlshr", flatten2bv(extractbit_expr.src()), convert_expr(tmp))),
13251322
smt2_astt("bin1"));
13261323
}
13271324
}
@@ -1538,21 +1535,19 @@ smt2_astt smt2_convt::convert_expr(const exprt &expr)
15381535
convert_expr(expr.op0())),
15391536
smt2_sign_extend(smt2_astt::integer(mp_integer(1)))(
15401537
convert_expr(expr.op1()))))},
1541-
smt2_not(
1542-
smt2_eq(
1543-
smt2_extract(width, width)(smt2_astt("?sum")),
1544-
smt2_extract(width - 1, width - 1)(smt2_astt("?sum")))));
1538+
smt2_not(smt2_eq(
1539+
smt2_extract(width, width)(smt2_astt("?sum")),
1540+
smt2_extract(width - 1, width - 1)(smt2_astt("?sum")))));
15451541
}
15461542
else if(op_type.id()==ID_unsignedbv ||
15471543
op_type.id()==ID_pointer)
15481544
{
15491545
// overflow is simply carry-out
15501546
return smt2_eq(
1551-
smt2_extract(width, width)(
1552-
smt2_astt::make(
1553-
(subtract ? "bvsub" : "bvadd"),
1554-
smt2_zero_extend(1)(convert_expr(expr.op0())),
1555-
smt2_zero_extend(1)(convert_expr(expr.op1())))),
1547+
smt2_extract(width, width)(smt2_astt::make(
1548+
(subtract ? "bvsub" : "bvadd"),
1549+
smt2_zero_extend(1)(convert_expr(expr.op0())),
1550+
smt2_zero_extend(1)(convert_expr(expr.op1())))),
15561551
smt2_astt("#b1"));
15571552
}
15581553
else
@@ -1732,12 +1727,11 @@ smt2_astt smt2_convt::convert_expr(const exprt &expr)
17321727

17331728
for(std::size_t byte = 0; byte < bytes; byte++)
17341729
{
1735-
bindings.push_back(
1736-
std::make_pair(
1737-
smt2_astt("bswap_byte_" + byte),
1738-
smt2_extract(
1739-
(byte * bits_per_byte + (bits_per_byte - 1)),
1740-
(byte * bits_per_byte))(smt2_astt("bswap_op"))));
1730+
bindings.push_back(std::make_pair(
1731+
smt2_astt("bswap_byte_" + byte),
1732+
smt2_extract(
1733+
(byte * bits_per_byte + (bits_per_byte - 1)),
1734+
(byte * bits_per_byte))(smt2_astt("bswap_op"))));
17411735
}
17421736

17431737
auto concat_node = smt2_astt::make("concat");
@@ -1872,9 +1866,8 @@ smt2_astt smt2_convt::convert_typecast(const typecast_exprt &expr)
18721866
if(to_width > from_integer_bits)
18731867
{
18741868
return smt2_sign_extend(
1875-
smt2_astt::integer(to_width - from_integer_bits))(
1876-
smt2_extract(from_width - 1, from_fraction_bits)(
1877-
convert_expr(src)));
1869+
smt2_astt::integer(to_width - from_integer_bits))(smt2_extract(
1870+
from_width - 1, from_fraction_bits)(convert_expr(src)));
18781871
}
18791872
else
18801873
{
@@ -1885,10 +1878,9 @@ smt2_astt smt2_convt::convert_typecast(const typecast_exprt &expr)
18851878
}(),
18861879
smt2_ite(
18871880
smt2_and(
1888-
smt2_not(
1889-
smt2_eq(
1890-
smt2_extract(from_fraction_bits - 1, 0)(smt2_astt("?tcop")),
1891-
smt2_bv(0, from_fraction_bits))),
1881+
smt2_not(smt2_eq(
1882+
smt2_extract(from_fraction_bits - 1, 0)(smt2_astt("?tcop")),
1883+
smt2_bv(0, from_fraction_bits))),
18921884
smt2_eq(
18931885
smt2_extract(from_width - 1, from_width - 1)(
18941886
smt2_astt("?tcop")),
@@ -2061,9 +2053,8 @@ smt2_astt smt2_convt::convert_typecast(const typecast_exprt &expr)
20612053
}
20622054
else
20632055
{
2064-
return smt2_sign_extend(
2065-
smt2_astt::integer(to_integer_bits - from_width))(
2066-
convert_expr(src));
2056+
return smt2_sign_extend(smt2_astt::integer(
2057+
to_integer_bits - from_width))(convert_expr(src));
20672058
}
20682059
}
20692060
}(),
@@ -2690,10 +2681,8 @@ smt2_astt smt2_convt::convert_is_dynamic_object(const exprt &expr)
26902681
auto node = smt2_astt::make("or");
26912682
for(const auto &object : dynamic_objects)
26922683
{
2693-
node.add_child(
2694-
smt2_eq(
2695-
smt2_bv(object, config.bv_encoding.object_bits),
2696-
smt2_astt("?obj")));
2684+
node.add_child(smt2_eq(
2685+
smt2_bv(object, config.bv_encoding.object_bits), smt2_astt("?obj")));
26972686
}
26982687
return node;
26992688
}());
@@ -3099,12 +3088,11 @@ smt2_astt smt2_convt::convert_div(const div_exprt &expr)
30993088
fixedbv_spect spec(to_fixedbv_type(expr.type()));
31003089
std::size_t fraction_bits=spec.get_fraction_bits();
31013090

3102-
return smt2_extract(spec.width - 1, 0)(
3091+
return smt2_extract(spec.width - 1, 0)(smt2_astt::make(
3092+
"bvsdiv",
31033093
smt2_astt::make(
3104-
"bvsdiv",
3105-
smt2_astt::make(
3106-
"concat", convert_expr(expr.op0()), smt2_bv(0, fraction_bits)),
3107-
smt2_sign_extend(fraction_bits)(convert_expr(expr.op1()))));
3094+
"concat", convert_expr(expr.op0()), smt2_bv(0, fraction_bits)),
3095+
smt2_sign_extend(fraction_bits)(convert_expr(expr.op1()))));
31083096
}
31093097
else if(expr.type().id()==ID_floatbv)
31103098
{
@@ -3498,24 +3486,22 @@ smt2_astt smt2_convt::convert_index(const index_exprt &expr)
34983486
std::size_t sub_width=boolbv_width(array_type.subtype());
34993487
std::size_t index_width=boolbv_width(expr.index().type());
35003488

3501-
auto node = smt2_extract(sub_width - 1, 0)(
3502-
smt2_astt::make(
3503-
"bvlshr",
3504-
convert_expr(expr.array()),
3505-
smt2_astt::make("bvmul", smt2_bv(sub_width, array_width), [&] {
3506-
// SMT2 says that the shift distance must be the same as
3507-
// the width of what we shift.
3508-
if(array_width > index_width)
3509-
{
3510-
return smt2_zero_extend(array_width - index_width)(
3511-
convert_expr(expr.index()));
3512-
}
3513-
else
3514-
{
3515-
return smt2_extract(array_width - 1, 0)(
3516-
convert_expr(expr.index()));
3517-
}
3518-
}())));
3489+
auto node = smt2_extract(sub_width - 1, 0)(smt2_astt::make(
3490+
"bvlshr",
3491+
convert_expr(expr.array()),
3492+
smt2_astt::make("bvmul", smt2_bv(sub_width, array_width), [&] {
3493+
// SMT2 says that the shift distance must be the same as
3494+
// the width of what we shift.
3495+
if(array_width > index_width)
3496+
{
3497+
return smt2_zero_extend(array_width - index_width)(
3498+
convert_expr(expr.index()));
3499+
}
3500+
else
3501+
{
3502+
return smt2_extract(array_width - 1, 0)(convert_expr(expr.index()));
3503+
}
3504+
}())));
35193505

35203506
return unflatten(array_type.subtype(), std::move(node));
35213507
}
@@ -3537,11 +3523,10 @@ smt2_astt smt2_convt::convert_index(const index_exprt &expr)
35373523
}
35383524
else
35393525
{
3540-
return smt2_astt(
3541-
std::vector<smt2_astt>{smt2_index(
3542-
smt2_astt(smt_typename),
3543-
smt2_astt::integer(index_int->to_long())),
3544-
convert_expr(expr.array())});
3526+
return smt2_astt(std::vector<smt2_astt>{
3527+
smt2_index(
3528+
smt2_astt(smt_typename), smt2_astt::integer(index_int->to_long())),
3529+
convert_expr(expr.array())});
35453530
}
35463531
}
35473532
else
@@ -3628,11 +3613,9 @@ smt2_astt smt2_convt::flatten2bv(const exprt &expr)
36283613
auto concat_node = smt2_astt::make("concat");
36293614
for(mp_integer i=0; i!=size; ++i)
36303615
{
3631-
concat_node.add_child(
3632-
smt2_astt(
3633-
std::vector<smt2_astt>{
3634-
smt2_index(smt2_astt(smt_typename), smt2_astt::integer(i)),
3635-
smt2_astt("?vflop")}));
3616+
concat_node.add_child(smt2_astt(std::vector<smt2_astt>{
3617+
smt2_index(smt2_astt(smt_typename), smt2_astt::integer(i)),
3618+
smt2_astt("?vflop")}));
36363619
}
36373620
return smt2_let(
36383621
{std::make_pair(smt2_astt("?vflop"), convert_expr(expr))},
@@ -3656,22 +3639,20 @@ smt2_astt smt2_convt::flatten2bv(const exprt &expr)
36563639
const struct_typet::componentst &components=
36573640
struct_type.components();
36583641

3659-
auto concat_node = smt2_astt(
3660-
std::vector<smt2_astt>{
3661-
smt2_index(
3662-
smt2_astt(smt_typename),
3663-
smt2_astt(id2string(components[0].get_name()))),
3664-
smt2_astt("?sflop")});
3642+
auto concat_node = smt2_astt(std::vector<smt2_astt>{
3643+
smt2_index(
3644+
smt2_astt(smt_typename),
3645+
smt2_astt(id2string(components[0].get_name()))),
3646+
smt2_astt("?sflop")});
36653647

36663648
// SMT-LIB 2 concat is binary only
36673649
for(std::size_t i = 0; i < components.size(); ++i)
36683650
{
36693651
concat_node = smt2_concat(
3670-
smt2_astt(
3671-
std::vector<smt2_astt>{smt2_index(
3672-
smt2_astt(smt_typename),
3673-
smt2_astt(components[i - 1].get_name())),
3674-
smt2_astt("?sflop")}),
3652+
smt2_astt(std::vector<smt2_astt>{
3653+
smt2_index(
3654+
smt2_astt(smt_typename), smt2_astt(components[i - 1].get_name())),
3655+
smt2_astt("?sflop")}),
36753656
std::move(concat_node));
36763657
}
36773658

@@ -3729,9 +3710,8 @@ smt2_astt smt2_convt::unflatten(
37293710
auto extract_node = smt2_extract(offset + subtype_width - 1, offset)(
37303711
smt2_astt("?ufop"));
37313712
extract_node.add_child(smt2_astt::integer(nesting));
3732-
mk_node.add_child(
3733-
unflatten(
3734-
vector_type.subtype(), std::move(extract_node), nesting + 1));
3713+
mk_node.add_child(unflatten(
3714+
vector_type.subtype(), std::move(extract_node), nesting + 1));
37353715
}
37363716
return mk_node;
37373717
}());
@@ -3745,8 +3725,7 @@ smt2_astt smt2_convt::unflatten(
37453725
}
37463726

37473727
return smt2_let(
3748-
{std::make_pair(smt2_astt("?ufop"), smt2_astt::integer(nesting))},
3749-
[&]() {
3728+
{std::make_pair(smt2_astt("?ufop"), smt2_astt::integer(nesting))}, [&]() {
37503729
// TODO ast is missing from here!!!
37513730

37523731
// extract members

0 commit comments

Comments
 (0)