exprt pointer_logict::pointer_expr( const pointert &pointer, const typet &type) const { if(pointer.object==null_object) // NULL? { if(pointer.offset==0) { constant_exprt result(type); result.set_value(ID_NULL); return result; } else { constant_exprt null(type); null.set_value(ID_NULL); return plus_exprt(null, from_integer(pointer.offset, pointer_diff_type())); } } else if(pointer.object==invalid_object) // INVALID? { constant_exprt result(type); result.set_value("INVALID"); return result; } if(pointer.object>=objects.size()) { constant_exprt result(type); result.set_value("INVALID-"+std::to_string(pointer.object)); return result; } const exprt &object_expr=objects[pointer.object]; exprt deep_object=object_rec(pointer.offset, type, object_expr); exprt result; if(type.id()==ID_pointer) result=exprt(ID_address_of, type); else if(type.id()==ID_reference) result=exprt("reference_to", type); else assert(0); result.copy_to_operands(deep_object); return result; }
typet signed_size_type() { // we presume this is the same as pointer difference return pointer_diff_type(); }