Skip to content

copy_to_operands(exprt &&) -> add_to_operands #3254

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
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
43 changes: 34 additions & 9 deletions src/util/expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,14 @@ class exprt:public irept
void reserve_operands(operandst::size_type n)
{ operands().reserve(n) ; }

DEPRECATED("use copy_to_operands(expr) instead")
DEPRECATED("use add_to_operands(std::move(expr)) instead")
void move_to_operands(exprt &expr);

DEPRECATED("use copy_to_operands(e1, e2) instead")
DEPRECATED("use add_to_operands(std::move(e1), std::move(e2)) instead")
void move_to_operands(exprt &e1, exprt &e2);

DEPRECATED("use copy_to_operands(e1, e2, e3) instead")
DEPRECATED(
"use add_to_operands(std::move(e1), std::move(e2), std::move(e3)) instead")
void move_to_operands(exprt &e1, exprt &e2, exprt &e3);

/// Copy the given argument to the end of `exprt`'s operands.
Expand All @@ -121,9 +122,16 @@ class exprt:public irept
operands().push_back(expr);
}

/// Copy the given argument to the end of `exprt`'s operands.
/// Add the given argument to the end of `exprt`'s operands.
/// \param expr: `exprt` to append to the operands
void add_to_operands(const exprt &expr)
{
copy_to_operands(expr);
}

/// Add the given argument to the end of `exprt`'s operands.
/// \param expr: `exprt` to append to the operands
void copy_to_operands(exprt &&expr)
void add_to_operands(exprt &&expr)
{
operands().push_back(std::move(expr));
}
Expand All @@ -141,10 +149,18 @@ class exprt:public irept
op.push_back(e2);
}

/// Copy the given arguments to the end of `exprt`'s operands.
/// Add the given arguments to the end of `exprt`'s operands.
/// \param e1: first `exprt` to append to the operands
/// \param e2: second `exprt` to append to the operands
void add_to_operands(const exprt &e1, const exprt &e2)
{
copy_to_operands(e1, e2);
}

/// Add the given arguments to the end of `exprt`'s operands.
/// \param e1: first `exprt` to append to the operands
/// \param e2: second `exprt` to append to the operands
void copy_to_operands(exprt &&e1, exprt &&e2)
void add_to_operands(exprt &&e1, exprt &&e2)
{
operandst &op = operands();
#ifndef USE_LIST
Expand All @@ -154,6 +170,15 @@ class exprt:public irept
op.push_back(std::move(e2));
}

/// Add the given arguments to the end of `exprt`'s operands.
/// \param e1: first `exprt` to append to the operands
/// \param e2: second `exprt` to append to the operands
/// \param e3: third `exprt` to append to the operands
void add_to_operands(const exprt &e1, const exprt &e2, const exprt &e3)
{
copy_to_operands(e1, e2, e3);
}

/// Copy the given arguments to the end of `exprt`'s operands.
/// \param e1: first `exprt` to append to the operands
/// \param e2: second `exprt` to append to the operands
Expand All @@ -169,11 +194,11 @@ class exprt:public irept
op.push_back(e3);
}

/// Copy the given arguments to the end of `exprt`'s operands.
/// Add the given arguments to the end of `exprt`'s operands.
/// \param e1: first `exprt` to append to the operands
/// \param e2: second `exprt` to append to the operands
/// \param e3: third `exprt` to append to the operands
void copy_to_operands(exprt &&e1, exprt &&e2, exprt &&e3)
void add_to_operands(exprt &&e1, exprt &&e2, exprt &&e3)
{
operandst &op = operands();
#ifndef USE_LIST
Expand Down
2 changes: 1 addition & 1 deletion src/util/std_code.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class code_blockt:public codet

void add(codet &&code)
{
copy_to_operands(std::move(code));
add_to_operands(std::move(code));
}

void add(codet code, const source_locationt &loc)
Expand Down