Skip to content

Commit 431eb3e

Browse files
author
Daniel Kroening
committed
introduce expr_protectedt
This will serve as the interface that we aspire exprt to offer; in particular, access to opX is protected.
1 parent 139637c commit 431eb3e

File tree

3 files changed

+96
-95
lines changed

3 files changed

+96
-95
lines changed

src/util/expr.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,28 @@ class exprt:public irept
319319
const_unique_depth_iteratort unique_depth_cend() const;
320320
};
321321

322+
/// Base class for all expressions. This protects low-level methods in
323+
/// exprt that are not type safe. Depcrecated constructors are removed.
324+
/// This API will eventually replace exprt.
325+
class expr_protectedt : public exprt
326+
{
327+
protected:
328+
// constructors
329+
expr_protectedt(const irep_idt &_id, const typet &_type) : exprt(_id, _type)
330+
{
331+
}
332+
333+
// protect these low-level methods
334+
using exprt::add;
335+
using exprt::make_bool;
336+
using exprt::make_typecast;
337+
using exprt::op0;
338+
using exprt::op1;
339+
using exprt::op2;
340+
using exprt::op3;
341+
using exprt::remove;
342+
};
343+
322344
class expr_visitort
323345
{
324346
public:

src/util/std_expr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ extractbits_exprt::extractbits_exprt(
167167
const exprt &_src,
168168
const std::size_t _upper,
169169
const std::size_t _lower,
170-
const typet &_type):
171-
exprt(ID_extractbits, _type)
170+
const typet &_type)
171+
: expr_protectedt(ID_extractbits, _type)
172172
{
173173
PRECONDITION(_upper >= _lower);
174174
operands().resize(3);

0 commit comments

Comments
 (0)