Skip to content

Commit 7c61202

Browse files
committed
Simplify, improve code style
Signed-off-by: František Nečas <[email protected]>
1 parent 1542852 commit 7c61202

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed

src/domains/predabs_domain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ void predabs_domaint::initialize_value(domaint::valuet &value)
3030
for(std::size_t row=0; row<templ.size(); ++row)
3131
{
3232
// start from top (we can only use a gfp solver for this domain)
33-
v[row]=row_valuet(false_exprt());
33+
v[row]=row_valuet();
3434
}
3535
}
3636

src/domains/predabs_domain.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@ class predabs_domaint:public simple_domaint
3535

3636
struct row_valuet:constant_exprt
3737
{
38-
row_valuet() : constant_exprt(false_exprt())
39-
{}
38+
row_valuet() : constant_exprt(false_exprt()) {}
4039

41-
explicit row_valuet(const constant_exprt &value) : constant_exprt(value)
42-
{}
40+
explicit row_valuet(const constant_exprt &value) : constant_exprt(value) {}
4341
};
4442

4543
struct templ_valuet:simple_domaint::valuet, std::vector<row_valuet>

src/ssa/address_canonizer.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,9 @@ exprt address_canonizer(
5151
unsigned_char_type(),
5252
config.ansi_c.pointer_width);
5353
typecast_exprt typecast_expr(rec_result, byte_pointer);
54-
exprt result;
55-
plus_exprt sum(typecast_expr, *maybe_offset);
56-
result=sum;
57-
if(sum.type()!=address.type())
58-
result=typecast_exprt(sum, address.type());
54+
exprt result=plus_exprt(typecast_expr, *maybe_offset);
55+
if(result.type()!=address.type())
56+
result=typecast_exprt(result, address.type());
5957

6058
return result;
6159
}
@@ -68,11 +66,9 @@ exprt address_canonizer(
6866

6967
pointer_typet pointer_type(object.type(), config.ansi_c.pointer_width);
7068
typecast_exprt typecast_expr(rec_result, pointer_type);
71-
exprt result;
72-
plus_exprt sum(typecast_expr, to_index_expr(object).index());
73-
result=sum;
74-
if(sum.type()!=address.type())
75-
result=typecast_exprt(sum, address.type());
69+
exprt result=plus_exprt(typecast_expr, to_index_expr(object).index());
70+
if(result.type()!=address.type())
71+
result=typecast_exprt(result, address.type());
7672

7773
return result;
7874
}

0 commit comments

Comments
 (0)