Skip to content

Commit f371b86

Browse files
author
Enrico Steffinlongo
committed
Improved interface for c_enum_typet
Interface for c_enum_typet has limited support for management of enum members. This commit adds - a function for exposing the member vector as a non-const reference, - a constructor that takes the underlying type and a list of members and sets the constructed type accordingly.
1 parent eca493e commit f371b86

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/util/c_types.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,17 @@ class c_enum_typet : public type_with_subtypet
274274

275275
typedef std::vector<c_enum_membert> memberst;
276276

277+
c_enum_typet(typet _subtype, memberst enum_members)
278+
: c_enum_typet(std::move(_subtype))
279+
{
280+
members() = std::move(enum_members);
281+
}
282+
283+
memberst &members()
284+
{
285+
return (memberst &)(add(ID_body).get_sub());
286+
}
287+
277288
const memberst &members() const
278289
{
279290
return (const memberst &)(find(ID_body).get_sub());

0 commit comments

Comments
 (0)