Skip to content

Commit 8ca4419

Browse files
authored
Merge pull request #3160 from diffblue/type-with-subtype-constructor
type_with_subtype constructor
2 parents 0802e42 + f1f4cb1 commit 8ca4419

File tree

2 files changed

+13
-24
lines changed

2 files changed

+13
-24
lines changed

src/util/std_types.h

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,29 +1122,14 @@ inline incomplete_array_typet &to_incomplete_array_type(typet &type)
11221122
/// Superclass of anything represented by bits, for example integers (in 32
11231123
/// or 64-bit representation), floating point numbers etc. In contrast, \ref
11241124
/// integer_typet is a direct integer representation.
1125-
class bitvector_typet:public type_with_subtypet
1125+
class bitvector_typet : public typet
11261126
{
11271127
public:
1128-
explicit bitvector_typet(const irep_idt &_id):type_with_subtypet(_id)
1128+
explicit bitvector_typet(const irep_idt &_id) : typet(_id)
11291129
{
11301130
}
11311131

1132-
bitvector_typet(const irep_idt &_id, const typet &_subtype):
1133-
type_with_subtypet(_id, _subtype)
1134-
{
1135-
}
1136-
1137-
bitvector_typet(
1138-
const irep_idt &_id,
1139-
const typet &_subtype,
1140-
std::size_t width):
1141-
type_with_subtypet(_id, _subtype)
1142-
{
1143-
set_width(width);
1144-
}
1145-
1146-
bitvector_typet(const irep_idt &_id, std::size_t width):
1147-
type_with_subtypet(_id)
1132+
bitvector_typet(const irep_idt &_id, std::size_t width) : typet(_id)
11481133
{
11491134
set_width(width);
11501135
}
@@ -1485,12 +1470,15 @@ inline floatbv_typet &to_floatbv_type(typet &type)
14851470
}
14861471

14871472
/// Type for C bit fields
1473+
/// These are both 'bitvector_typet' (they have a width)
1474+
/// and 'type_with_subtypet' (they have a subtype)
14881475
class c_bit_field_typet:public bitvector_typet
14891476
{
14901477
public:
1491-
explicit c_bit_field_typet(const typet &subtype, std::size_t width):
1492-
bitvector_typet(ID_c_bit_field, subtype, width)
1478+
explicit c_bit_field_typet(const typet &_subtype, std::size_t width)
1479+
: bitvector_typet(ID_c_bit_field, width)
14931480
{
1481+
subtype() = _subtype;
14941482
}
14951483

14961484
// These have a sub-type
@@ -1527,12 +1515,15 @@ inline c_bit_field_typet &to_c_bit_field_type(typet &type)
15271515
}
15281516

15291517
/// The pointer type
1518+
/// These are both 'bitvector_typet' (they have a width)
1519+
/// and 'type_with_subtypet' (they have a subtype)
15301520
class pointer_typet:public bitvector_typet
15311521
{
15321522
public:
1533-
pointer_typet(const typet &_subtype, std::size_t width):
1534-
bitvector_typet(ID_pointer, _subtype, width)
1523+
pointer_typet(const typet &_subtype, std::size_t width)
1524+
: bitvector_typet(ID_pointer, width)
15351525
{
1526+
subtype() = _subtype;
15361527
}
15371528

15381529
signedbv_typet difference_type() const

src/util/type.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ class typet:public irept
8080
class type_with_subtypet:public typet
8181
{
8282
public:
83-
type_with_subtypet() { }
84-
8583
explicit type_with_subtypet(const irep_idt &_id):typet(_id) { }
8684
type_with_subtypet(const irep_idt &_id, const typet &_subtype):
8785
typet(_id)

0 commit comments

Comments
 (0)