Go to the documentation of this file.
9 #ifndef CPROVER_UTIL_POINTER_EXPR_H
10 #define CPROVER_UTIL_POINTER_EXPR_H
68 return type.
id() == ID_pointer;
98 return type.
id() == ID_pointer &&
112 set(ID_C_reference,
true);
121 vm, type.
get_sub().size() == 1,
"reference must have one type parameter");
172 ID_object_descriptor,
181 ID_object_descriptor,
223 return base.
id() == ID_object_descriptor;
287 return base.
id() == ID_dynamic_object;
342 return base.
id() == ID_is_dynamic_object;
355 expr.
operands().size() == 1,
"is_dynamic_object must have one operand");
365 expr.
operands().size() == 1,
"is_dynamic_object must have one operand");
376 :
unary_exprt(ID_address_of, std::move(
op), std::move(_type))
394 return base.
id() == ID_address_of;
435 return get(ID_identifier);
460 return base.
id() == ID_object_address;
537 return get(ID_component_name);
544 return expr.
id() == ID_field_address;
626 return expr.
id() == ID_element_address;
690 "dereference expression must have one operand");
702 return base.
id() == ID_dereference;
767 expr.
id() == ID_r_ok || expr.
id() == ID_w_ok || expr.
id() == ID_rw_ok);
822 const exprt &_pointer)
823 :
unary_exprt(ID_annotated_pointer_constant, _pointer, _pointer.
type())
830 return get(ID_value);
835 set(ID_value, value);
852 return base.
id() == ID_annotated_pointer_constant;
858 value, 1,
"Annotated pointer constant must have one operand");
911 return base.
id() == ID_pointer_offset;
919 "pointer_offset must have pointer-typed operand");
969 return base.
id() == ID_pointer_object;
977 "pointer_object must have pointer-typed operand");
1051 return base.
id() == ID_object_size;
1059 "Object size expression must have pointer typed operand.");
1088 return base.
id() == ID_is_cstring;
1146 return base.
id() == ID_cstrlen;
1202 return base.
id() == ID_live_object;
1258 return base.
id() == ID_writeable_object;
1290 #endif // CPROVER_UTIL_POINTER_EXPR_H
const element_address_exprt & to_element_address_expr(const exprt &expr)
Cast an exprt to an element_address_exprt.
dynamic_object_exprt(typet type)
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
live_object_exprt(exprt pointer)
const r_or_w_ok_exprt & to_r_or_w_ok_expr(const exprt &expr)
const exprt & base() const
#define DATA_CHECK(vm, condition, message)
This macro takes a condition which denotes a well-formedness criterion on goto programs,...
const typet & subtype() const
bool can_cast_expr< dynamic_object_exprt >(const exprt &base)
bool can_cast_expr< address_of_exprt >(const exprt &base)
const irep_idt & get_value() const
void build(const exprt &expr, const namespacet &ns)
Given an expression expr, attempt to find the underlying object it represents by skipping over type c...
w_ok_exprt(exprt pointer, exprt size)
const exprt & index() const
const dereference_exprt & to_dereference_expr(const exprt &expr)
Cast an exprt to a dereference_exprt.
The type of an expression, extends irept.
Operator to return the address of a field relative to a base address.
static void check(const typet &type, const validation_modet vm=validation_modet::INVARIANT)
const typet & object_type() const
returns the type of the object whose address is represented
Operator to dereference a pointer.
Representation of heap-allocated objects.
const annotated_pointer_constant_exprt & to_annotated_pointer_constant_expr(const exprt &expr)
Cast an exprt to an annotated_pointer_constant_exprt.
const exprt & pointer() const
Evaluates to true if the operand is a pointer to a dynamic object.
void validate_operands(const exprt &value, exprt::operandst::size_type number, const char *message, bool allow_more=false)
Split an expression into a base object and a (byte) offset.
static void validate(const exprt &expr, const namespacet &ns, const validation_modet vm=validation_modet::INVARIANT)
Check that the dereference expression has the right number of operands, refers to something with a po...
object_address_exprt(const symbol_exprt &)
field_address_exprt(exprt base, const irep_idt &component_name, pointer_typet type)
constructor for field addresses.
bool can_cast_expr< object_descriptor_exprt >(const exprt &base)
address_of_exprt(const exprt &op)
bool can_cast_expr< pointer_object_exprt >(const exprt &base)
Base class for all expressions.
typet & base_type()
The type of the data what we point to.
irep_idt object_identifier() const
Generic base class for unary expressions.
dereference_exprt(const exprt &op)
A base class for binary expressions.
const exprt & root_object() const
const exprt & pointer() const
cstrlen_exprt(exprt address, typet type)
Expression to hold a symbol (variable)
Expression for finding the size (in bytes) of the object a pointer points to.
bool is_rvalue_reference(const typet &type)
Returns if the type is an R value reference.
pointer_object_exprt(exprt pointer, typet type)
const pointer_typet & type() const
bool can_cast_type< pointer_typet >(const typet &type)
Check whether a reference to a typet is a pointer_typet.
const irep_idt & get(const irep_idt &name) const
const exprt & pointer() const
const writeable_object_exprt & to_writeable_object_expr(const exprt &expr)
Cast an exprt to a writeable_object_exprt.
const object_descriptor_exprt & to_object_descriptor_expr(const exprt &expr)
Cast an exprt to an object_descriptor_exprt.
symbol_exprt object_expr() const
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
typet & type()
Return the type of the expression.
const pointer_object_exprt & to_pointer_object_expr(const exprt &expr)
Cast an exprt to a pointer_object_exprt.
An expression without operands.
unsigned int get_instance() const
Operator to return the address of an object.
const pointer_typet & type() const
address_of_exprt(exprt op, pointer_typet _type)
const cstrlen_exprt & to_cstrlen_expr(const exprt &expr)
Cast an exprt to a cstrlen_exprt.
const T & as_const(T &value)
Return a reference to the same object but ensures the type is const.
const exprt & pointer() const
const exprt & base() const
element_address_exprt(const exprt &base, exprt index)
constructor for element addresses.
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
bool can_cast_expr< object_size_exprt >(const exprt &base)
object_size_exprt(exprt pointer, typet type)
The null pointer constant.
const object_address_exprt & to_object_address_expr(const exprt &expr)
Cast an exprt to an object_address_exprt.
const exprt & address() const
bool can_cast_expr< is_dynamic_object_exprt >(const exprt &base)
void set(const irep_idt &name, const irep_idt &value)
void validate_expr(const object_descriptor_exprt &value)
A base class for expressions that are predicates, i.e., Boolean-typed, and that take exactly two argu...
#define PRECONDITION(CONDITION)
const typet & field_type() const
returns the type of the field whose address is represented
dereference_exprt(exprt op, typet type)
Fixed-width bit-vector with two's complement interpretation.
const typet & element_type() const
returns the type of the array element whose address is represented
bool can_cast_expr< dereference_exprt >(const exprt &base)
annotated_pointer_constant_exprt(const irep_idt &_value, const exprt &_pointer)
null_pointer_exprt(pointer_typet type)
const exprt & valid() const
const pointer_typet & to_pointer_type(const typet &type)
Cast a typet to a pointer_typet.
A predicate that indicates that a zero-terminated string starts at the given address.
A numerical identifier for the object a pointer points to.
is_dynamic_object_exprt(const exprt &op)
const reference_typet & to_reference_type(const typet &type)
Cast a typet to a reference_typet.
bool can_cast_expr< is_cstring_exprt >(const exprt &base)
const irep_idt & id() const
Pointer-typed bitvector constant annotated with the pointer expression that the bitvector is the nume...
const exprt & object() const
An expression, akin to ISO C's strlen, that denotes the length of a zero-terminated string that start...
bool can_cast_expr< field_address_exprt >(const exprt &expr)
reference_typet(typet _subtype, std::size_t _width)
const dynamic_object_exprt & to_dynamic_object_expr(const exprt &expr)
Cast an exprt to a dynamic_object_exprt.
const irep_idt & component_name() const
A predicate that indicates that the object pointed to is writeable.
const exprt & pointer() const
r_ok_exprt(exprt pointer, exprt size)
object_descriptor_exprt(exprt _object)
const r_ok_exprt & to_r_ok_expr(const exprt &expr)
std::size_t get_width() const
reference_typet reference_type(const typet &subtype)
void set_value(const irep_idt &value)
pointer_typet(typet _base_type, std::size_t width)
void set_instance(unsigned int instance)
bool can_cast_expr< element_address_exprt >(const exprt &expr)
bool is_reference(const typet &type)
Returns true if the type is a reference.
A predicate that indicates that an address range is ok to read.
const exprt & offset() const
Base class of fixed-width bit-vector types.
bool can_cast_expr< writeable_object_exprt >(const exprt &base)
The offset (in bytes) of a pointer relative to the object.
A predicate that indicates that an address range is ok to write.
const exprt & address() const
A predicate that indicates that the object pointed to is live.
const pointer_typet & type() const
const is_cstring_exprt & to_is_cstring_expr(const exprt &expr)
Cast an exprt to a is_cstring_exprt.
const field_address_exprt & to_field_address_expr(const exprt &expr)
Cast an exprt to an field_address_exprt.
const typet & base_type() const
The type of the data what we point to.
writeable_object_exprt(exprt pointer)
bool can_cast_expr< cstrlen_exprt >(const exprt &base)
A base class for a predicate that indicates that an address range is ok to read or write or both.
const pointer_offset_exprt & to_pointer_offset_expr(const exprt &expr)
Cast an exprt to a pointer_offset_exprt.
bool can_cast_expr< annotated_pointer_constant_exprt >(const exprt &base)
const live_object_exprt & to_live_object_expr(const exprt &expr)
Cast an exprt to a live_object_exprt.
is_cstring_exprt(exprt address)
r_or_w_ok_exprt(irep_idt id, exprt pointer, exprt size)
const address_of_exprt & to_address_of_expr(const exprt &expr)
Cast an exprt to an address_of_exprt.
bool can_cast_expr< object_address_exprt >(const exprt &base)
pointer_offset_exprt(exprt pointer, typet type)
bool is_void_pointer(const typet &type)
This method tests, if the given typet is a pointer of type void.
Operator to return the address of an object.
object_descriptor_exprt()
const exprt & object() const
The pointer type These are both 'bitvector_typet' (they have a width) and 'type_with_subtypet' (they ...
const typet & compound_type() const
A constant literal expression.
const exprt & pointer() const
Operator to return the address of an array element relative to a base address.
const is_dynamic_object_exprt & to_is_dynamic_object_expr(const exprt &expr)
const exprt & address() const
const exprt & pointer() const
const w_ok_exprt & to_w_ok_expr(const exprt &expr)
bool can_cast_expr< pointer_offset_exprt >(const exprt &base)
A base class for expressions that are predicates, i.e., Boolean-typed, and that take exactly one argu...
exprt & symbolic_pointer()
bool can_cast_expr< live_object_exprt >(const exprt &base)
static void check(const typet &type, const validation_modet vm=validation_modet::INVARIANT)
bool get_bool(const irep_idt &name) const
signedbv_typet difference_type() const
static void check(const typet &type, const validation_modet vm=validation_modet::INVARIANT)
const exprt & symbolic_pointer() const
bool can_cast_type< reference_typet >(const typet &type)
Check whether a reference to a typet is a reference_typet.
static void check(const exprt &expr, const validation_modet vm=validation_modet::INVARIANT)
const object_size_exprt & to_object_size_expr(const exprt &expr)
Cast an exprt to a object_size_exprt.
const exprt & size() const