File tree Expand file tree Collapse file tree 3 files changed +8
-53
lines changed
Expand file tree Collapse file tree 3 files changed +8
-53
lines changed Original file line number Diff line number Diff line change @@ -296,32 +296,4 @@ void show_goto_trace(
296296 if (cmdline.isset(" stack-trace" )) \
297297 options.set_option(" stack-trace" , true );
298298
299- // / Variety of constant expression only used in the context of a GOTO trace, to
300- // / give both the numeric value and the symbolic value of a pointer,
301- // / e.g. numeric value "0xabcd0004" but symbolic value "&some_object + 4". The
302- // / numeric value is stored in the `constant_exprt`'s usual value slot (see
303- // / \ref constant_exprt::get_value) and the symbolic value is accessed using the
304- // / `symbolic_pointer` method introduced by this class.
305- class goto_trace_constant_pointer_exprt : public constant_exprt
306- {
307- public:
308- const exprt &symbolic_pointer () const
309- {
310- return static_cast <const exprt &>(operands ()[0 ]);
311- }
312- };
313-
314- template <>
315- inline bool can_cast_expr<goto_trace_constant_pointer_exprt>(const exprt &base)
316- {
317- return can_cast_expr<constant_exprt>(base) && base.operands ().size () == 1 ;
318- }
319-
320- inline const goto_trace_constant_pointer_exprt &
321- to_goto_trace_constant_pointer_expr (const exprt &expr)
322- {
323- PRECONDITION (can_cast_expr<goto_trace_constant_pointer_exprt>(expr));
324- return static_cast <const goto_trace_constant_pointer_exprt &>(expr);
325- }
326-
327299#endif // CPROVER_GOTO_PROGRAMS_GOTO_TRACE_H
Original file line number Diff line number Diff line change @@ -22,29 +22,7 @@ bvt boolbvt::convert_constant(const constant_exprt &expr)
2222
2323 const typet &expr_type=expr.type ();
2424
25- if (expr_type.id ()==ID_array)
26- {
27- std::size_t op_width=width/expr.operands ().size ();
28- std::size_t offset=0 ;
29-
30- forall_operands (it, expr)
31- {
32- const bvt &tmp=convert_bv (*it);
33-
34- DATA_INVARIANT_WITH_DIAGNOSTICS (
35- tmp.size () == op_width,
36- " convert_constant: unexpected operand width" ,
37- irep_pretty_diagnosticst{expr});
38-
39- for (std::size_t j=0 ; j<op_width; j++)
40- bv[offset+j]=tmp[j];
41-
42- offset+=op_width;
43- }
44-
45- return bv;
46- }
47- else if (expr_type.id ()==ID_string)
25+ if (expr_type.id () == ID_string)
4826 {
4927 // we use the numbering for strings
5028 std::size_t number = string_numbering.number (expr.get_value ());
Original file line number Diff line number Diff line change @@ -2799,11 +2799,11 @@ inline type_exprt &to_type_expr(exprt &expr)
27992799}
28002800
28012801// / \brief A constant literal expression
2802- class constant_exprt : public expr_protectedt
2802+ class constant_exprt : public nullary_exprt
28032803{
28042804public:
28052805 constant_exprt (const irep_idt &_value, typet _type)
2806- : expr_protectedt (ID_constant, std::move(_type))
2806+ : nullary_exprt (ID_constant, std::move(_type))
28072807 {
28082808 set_value (_value);
28092809 }
@@ -2827,6 +2827,11 @@ inline bool can_cast_expr<constant_exprt>(const exprt &base)
28272827 return base.id () == ID_constant;
28282828}
28292829
2830+ inline void validate_expr (const constant_exprt &value)
2831+ {
2832+ validate_operands (value, 0 , " Constants must not have operands" );
2833+ }
2834+
28302835// / \brief Cast an exprt to a \ref constant_exprt
28312836// /
28322837// / \a expr must be known to be \ref constant_exprt.
You can’t perform that action at this time.
0 commit comments