Skip to content

Commit

Permalink
Add two-param code_typet constructors and deprecate the default one
Browse files Browse the repository at this point in the history
  • Loading branch information
peterschrammel committed Jun 5, 2018
1 parent 63a5131 commit 724a36c
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions src/util/std_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,30 @@ inline c_enum_tag_typet &to_c_enum_tag_type(typet &type)
class code_typet:public typet
{
public:
class parametert;
typedef std::vector<parametert> parameterst;

/// Constructs a new code type, i.e. function type
/// \param _parameters: the vector of function parameters
/// \param _return_type: the return type
code_typet(parameterst &&_parameters, typet &&_return_type) : typet(ID_code)
{
parameters().swap(_parameters);
return_type().swap(_return_type);
}

/// Constructs a new code type, i.e. function type
/// \param _parameters: the vector of function parameters
/// \param _return_type: the return type
code_typet(parameterst &&_parameters, const typet &_return_type)
: typet(ID_code)
{
parameters().swap(_parameters);
return_type() = _return_type;
}

/// \deprecated
DEPRECATED("Use the two argument constructor instead")
code_typet():typet(ID_code)
{
// make sure these properties are always there to avoid problems
Expand Down Expand Up @@ -862,8 +886,6 @@ class code_typet:public typet
add(ID_parameters).remove(ID_ellipsis);
}

typedef std::vector<parametert> parameterst;

const typet &return_type() const
{
return find_type(ID_return_type);
Expand Down

0 comments on commit 724a36c

Please sign in to comment.