Skip to content

Commit e4cffb5

Browse files
committed
Replace use of deprecated nil_typet in simplify_mult
Use optionalt<typet> as recommended in the deprecation note.
1 parent e17eb29 commit e4cffb5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/util/simplify_expr_int.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ bool simplify_exprt::simplify_mult(exprt &expr)
175175
// true if we have found a constant
176176
bool constant_found = false;
177177

178-
typet c_sizeof_type=nil_typet();
178+
optionalt<typet> c_sizeof_type;
179179

180180
// scan all the operands
181181
for(exprt::operandst::iterator it=operands.begin();
@@ -201,7 +201,7 @@ bool simplify_exprt::simplify_mult(exprt &expr)
201201
if(it->is_constant() && it->type()==expr.type())
202202
{
203203
// preserve the sizeof type annotation
204-
if(c_sizeof_type.is_nil())
204+
if(!c_sizeof_type.has_value())
205205
c_sizeof_type=
206206
static_cast<const typet &>(it->find(ID_C_c_sizeof_type));
207207

@@ -229,13 +229,13 @@ bool simplify_exprt::simplify_mult(exprt &expr)
229229
it++; // move to the next operand
230230
}
231231

232-
if(c_sizeof_type.is_not_nil())
232+
if(c_sizeof_type.has_value())
233233
{
234234
INVARIANT(
235235
constant_found,
236236
"c_sizeof_type is only set to a non-nil value "
237237
"if a constant has been found");
238-
constant->set(ID_C_c_sizeof_type, c_sizeof_type);
238+
constant->set(ID_C_c_sizeof_type, *c_sizeof_type);
239239
}
240240

241241
if(operands.size()==1)

0 commit comments

Comments
 (0)