File tree 4 files changed +119
-86
lines changed
4 files changed +119
-86
lines changed Original file line number Diff line number Diff line change @@ -319,6 +319,40 @@ class exprt:public irept
319
319
const_unique_depth_iteratort unique_depth_cend () const ;
320
320
};
321
321
322
+ // / Protected class for all expressions.
323
+ // / This API will eventually replace exprt.
324
+ class protected_exprt : public exprt
325
+ {
326
+ protected:
327
+ // constructors
328
+ DEPRECATED (" use protected_exprt(id, type) instead" )
329
+ protected_exprt () : exprt()
330
+ {
331
+ }
332
+
333
+ DEPRECATED (" use protected_exprt(id, type) instead" )
334
+ explicit protected_exprt (const irep_idt &_id) : exprt(_id)
335
+ {
336
+ }
337
+
338
+ protected_exprt (const irep_idt &_id, const typet &_type) : exprt(_id, _type)
339
+ {
340
+ }
341
+
342
+ // protect these low-level methods
343
+ using exprt::make_bool;
344
+ using exprt::make_typecast;
345
+ using exprt::op0;
346
+ using exprt::op1;
347
+ using exprt::op2;
348
+ using exprt::op3;
349
+ // using exprt::find;
350
+ // using exprt::get;
351
+ // using exprt::set;
352
+ using exprt::add;
353
+ using exprt::remove;
354
+ };
355
+
322
356
class expr_visitort
323
357
{
324
358
public:
Original file line number Diff line number Diff line change @@ -593,8 +593,11 @@ exprt build_sizeof_expr(
593
593
const constant_exprt &expr,
594
594
const namespacet &ns)
595
595
{
596
- const typet &type=
597
- static_cast <const typet &>(expr.find (ID_C_c_sizeof_type));
596
+ // need to cast down to access 'find'
597
+ const auto &expr_as_irep = static_cast <const irept &>(expr);
598
+
599
+ const typet &type =
600
+ static_cast <const typet &>(expr_as_irep.find (ID_C_c_sizeof_type));
598
601
599
602
if (type.is_nil ())
600
603
return nil_exprt ();
Original file line number Diff line number Diff line change @@ -150,8 +150,8 @@ extractbits_exprt::extractbits_exprt(
150
150
const exprt &_src,
151
151
const std::size_t _upper,
152
152
const std::size_t _lower,
153
- const typet &_type):
154
- exprt (ID_extractbits, _type)
153
+ const typet &_type)
154
+ : protected_exprt (ID_extractbits, _type)
155
155
{
156
156
PRECONDITION (_upper >= _lower);
157
157
operands ().resize (3 );
You can’t perform that action at this time.
0 commit comments