Skip to content

type_with_subtype constructor #3160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 13 additions & 22 deletions src/util/std_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -1122,29 +1122,14 @@ inline incomplete_array_typet &to_incomplete_array_type(typet &type)
/// Superclass of anything represented by bits, for example integers (in 32
/// or 64-bit representation), floating point numbers etc. In contrast, \ref
/// integer_typet is a direct integer representation.
class bitvector_typet:public type_with_subtypet
class bitvector_typet : public typet
{
public:
explicit bitvector_typet(const irep_idt &_id):type_with_subtypet(_id)
explicit bitvector_typet(const irep_idt &_id) : typet(_id)
{
}

bitvector_typet(const irep_idt &_id, const typet &_subtype):
type_with_subtypet(_id, _subtype)
{
}

bitvector_typet(
const irep_idt &_id,
const typet &_subtype,
std::size_t width):
type_with_subtypet(_id, _subtype)
{
set_width(width);
}

bitvector_typet(const irep_idt &_id, std::size_t width):
type_with_subtypet(_id)
bitvector_typet(const irep_idt &_id, std::size_t width) : typet(_id)
{
set_width(width);
}
Expand Down Expand Up @@ -1485,12 +1470,15 @@ inline floatbv_typet &to_floatbv_type(typet &type)
}

/// Type for C bit fields
/// These are both 'bitvector_typet' (they have a width)
/// and 'type_with_subtypet' (they have a subtype)
class c_bit_field_typet:public bitvector_typet
{
public:
explicit c_bit_field_typet(const typet &subtype, std::size_t width):
bitvector_typet(ID_c_bit_field, subtype, width)
explicit c_bit_field_typet(const typet &_subtype, std::size_t width)
: bitvector_typet(ID_c_bit_field, width)
{
subtype() = _subtype;
}

// These have a sub-type
Expand Down Expand Up @@ -1527,12 +1515,15 @@ inline c_bit_field_typet &to_c_bit_field_type(typet &type)
}

/// The pointer type
/// These are both 'bitvector_typet' (they have a width)
/// and 'type_with_subtypet' (they have a subtype)
class pointer_typet:public bitvector_typet
{
public:
pointer_typet(const typet &_subtype, std::size_t width):
bitvector_typet(ID_pointer, _subtype, width)
pointer_typet(const typet &_subtype, std::size_t width)
: bitvector_typet(ID_pointer, width)
{
subtype() = _subtype;
}

signedbv_typet difference_type() const
Expand Down
2 changes: 0 additions & 2 deletions src/util/type.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ class typet:public irept
class type_with_subtypet:public typet
{
public:
type_with_subtypet() { }

explicit type_with_subtypet(const irep_idt &_id):typet(_id) { }
type_with_subtypet(const irep_idt &_id, const typet &_subtype):
typet(_id)
Expand Down