Skip to content

Commit 023a392

Browse files
committed
Add and use validation methods in unsignedbv_typet
1 parent fb89fa4 commit 023a392

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/util/std_types.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,6 +1260,12 @@ class unsignedbv_typet:public bitvector_typet
12601260
constant_exprt smallest_expr() const;
12611261
constant_exprt zero_expr() const;
12621262
constant_exprt largest_expr() const;
1263+
1264+
void check(const validation_modet vm = validation_modet::INVARIANT) const
1265+
{
1266+
DATA_CHECK(
1267+
!get(ID_width).empty(), "unsigned bitvector type must have width");
1268+
}
12631269
};
12641270

12651271
/// Check whether a reference to a typet is a \ref unsignedbv_typet.
@@ -1289,7 +1295,7 @@ inline const unsignedbv_typet &to_unsignedbv_type(const typet &type)
12891295
{
12901296
PRECONDITION(can_cast_type<unsignedbv_typet>(type));
12911297
const unsignedbv_typet &ret = static_cast<const unsignedbv_typet &>(type);
1292-
validate_type(ret);
1298+
ret.check();
12931299
return ret;
12941300
}
12951301

@@ -1298,7 +1304,7 @@ inline unsignedbv_typet &to_unsignedbv_type(typet &type)
12981304
{
12991305
PRECONDITION(can_cast_type<unsignedbv_typet>(type));
13001306
unsignedbv_typet &ret = static_cast<unsignedbv_typet &>(type);
1301-
validate_type(ret);
1307+
ret.check();
13021308
return ret;
13031309
}
13041310

0 commit comments

Comments
 (0)