Skip to content

Commit 25d5bff

Browse files
authored
Merge pull request #3254 from smowton/smowton/cleanup/add-to-operands
copy_to_operands(exprt &&) -> add_to_operands
2 parents bcce848 + aea09dc commit 25d5bff

File tree

2 files changed

+35
-10
lines changed

2 files changed

+35
-10
lines changed

src/util/expr.h

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,14 @@ class exprt:public irept
105105
void reserve_operands(operandst::size_type n)
106106
{ operands().reserve(n) ; }
107107

108-
DEPRECATED("use copy_to_operands(expr) instead")
108+
DEPRECATED("use add_to_operands(std::move(expr)) instead")
109109
void move_to_operands(exprt &expr);
110110

111-
DEPRECATED("use copy_to_operands(e1, e2) instead")
111+
DEPRECATED("use add_to_operands(std::move(e1), std::move(e2)) instead")
112112
void move_to_operands(exprt &e1, exprt &e2);
113113

114-
DEPRECATED("use copy_to_operands(e1, e2, e3) instead")
114+
DEPRECATED(
115+
"use add_to_operands(std::move(e1), std::move(e2), std::move(e3)) instead")
115116
void move_to_operands(exprt &e1, exprt &e2, exprt &e3);
116117

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

124-
/// Copy the given argument to the end of `exprt`'s operands.
125+
/// Add the given argument to the end of `exprt`'s operands.
126+
/// \param expr: `exprt` to append to the operands
127+
void add_to_operands(const exprt &expr)
128+
{
129+
copy_to_operands(expr);
130+
}
131+
132+
/// Add the given argument to the end of `exprt`'s operands.
125133
/// \param expr: `exprt` to append to the operands
126-
void copy_to_operands(exprt &&expr)
134+
void add_to_operands(exprt &&expr)
127135
{
128136
operands().push_back(std::move(expr));
129137
}
@@ -141,10 +149,18 @@ class exprt:public irept
141149
op.push_back(e2);
142150
}
143151

144-
/// Copy the given arguments to the end of `exprt`'s operands.
152+
/// Add the given arguments to the end of `exprt`'s operands.
153+
/// \param e1: first `exprt` to append to the operands
154+
/// \param e2: second `exprt` to append to the operands
155+
void add_to_operands(const exprt &e1, const exprt &e2)
156+
{
157+
copy_to_operands(e1, e2);
158+
}
159+
160+
/// Add the given arguments to the end of `exprt`'s operands.
145161
/// \param e1: first `exprt` to append to the operands
146162
/// \param e2: second `exprt` to append to the operands
147-
void copy_to_operands(exprt &&e1, exprt &&e2)
163+
void add_to_operands(exprt &&e1, exprt &&e2)
148164
{
149165
operandst &op = operands();
150166
#ifndef USE_LIST
@@ -154,6 +170,15 @@ class exprt:public irept
154170
op.push_back(std::move(e2));
155171
}
156172

173+
/// Add the given arguments to the end of `exprt`'s operands.
174+
/// \param e1: first `exprt` to append to the operands
175+
/// \param e2: second `exprt` to append to the operands
176+
/// \param e3: third `exprt` to append to the operands
177+
void add_to_operands(const exprt &e1, const exprt &e2, const exprt &e3)
178+
{
179+
copy_to_operands(e1, e2, e3);
180+
}
181+
157182
/// Copy the given arguments to the end of `exprt`'s operands.
158183
/// \param e1: first `exprt` to append to the operands
159184
/// \param e2: second `exprt` to append to the operands
@@ -169,11 +194,11 @@ class exprt:public irept
169194
op.push_back(e3);
170195
}
171196

172-
/// Copy the given arguments to the end of `exprt`'s operands.
197+
/// Add the given arguments to the end of `exprt`'s operands.
173198
/// \param e1: first `exprt` to append to the operands
174199
/// \param e2: second `exprt` to append to the operands
175200
/// \param e3: third `exprt` to append to the operands
176-
void copy_to_operands(exprt &&e1, exprt &&e2, exprt &&e3)
201+
void add_to_operands(exprt &&e1, exprt &&e2, exprt &&e3)
177202
{
178203
operandst &op = operands();
179204
#ifndef USE_LIST

src/util/std_code.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ class code_blockt:public codet
149149

150150
void add(codet &&code)
151151
{
152-
copy_to_operands(std::move(code));
152+
add_to_operands(std::move(code));
153153
}
154154

155155
void add(codet code, const source_locationt &loc)

0 commit comments

Comments
 (0)