Go to the documentation of this file.
34 if(src.
id() == ID_typecast)
38 else if(src.
id() == ID_address_of)
42 if(
object.
id() == ID_symbol)
48 object.
id() == ID_member &&
56 object.
id() == ID_index &&
65 src.
id() == ID_member &&
86 if(type.
id() == ID_unsignedbv)
92 else if(type.
id() == ID_signedbv)
98 else if(type.
id() == ID_floatbv)
104 else if(type.
id() == ID_bv)
110 else if(type.
id() == ID_c_bit_field)
116 else if(type.
id() == ID_c_enum_tag)
122 else if(type.
id() == ID_fixedbv)
128 else if(type.
id() == ID_pointer)
133 else if(type.
id() == ID_bool)
137 else if(type.
id() == ID_array)
143 else if(type.
id() == ID_vector)
149 else if(type.
id() == ID_struct)
162 else if(type.
id() == ID_struct_tag)
166 else if(type.
id() == ID_union)
179 else if(type.
id() == ID_union_tag)
192 if(src.
type().
id() == ID_c_enum)
211 if(expr.
id() == ID_constant)
217 std::unique_ptr<languaget> lang;
218 if(mode != ID_unknown)
223 const typet &underlying_type =
227 std::string type_string;
228 bool error = lang->
from_type(underlying_type, type_string, ns);
231 std::string value_string;
235 type.
id() == ID_unsignedbv || type.
id() == ID_signedbv ||
236 type.
id() == ID_c_bit_field || type.
id() == ID_c_bool)
246 else if(type.
id() == ID_c_enum)
255 else if(type.
id() == ID_c_enum_tag)
260 return json(tmp, ns, mode);
262 else if(type.
id() == ID_bv)
267 else if(type.
id() == ID_fixedbv)
276 else if(type.
id() == ID_floatbv)
285 else if(type.
id() == ID_pointer)
292 else if(type.
id() == ID_bool)
298 else if(type.
id() == ID_string)
308 else if(expr.
id() == ID_annotated_pointer_constant)
314 if(simpl_expr.
id() == ID_symbol)
320 std::unique_ptr<languaget> lang;
321 if(mode != ID_unknown)
326 const typet &underlying_type =
327 type.
id() == ID_c_bit_field
331 std::string type_string;
332 bool error = lang->
from_type(underlying_type, type_string, ns);
340 "pointer identifier should have non-empty components");
343 else if(simpl_expr.
id() == ID_constant)
344 return json(simpl_expr, ns, mode);
348 else if(expr.
id() == ID_array)
353 std::size_t index = 0;
358 {
"value",
json(*it, ns, mode)}};
363 else if(expr.
id() == ID_struct)
370 if(type.
id() == ID_struct)
375 components.size() == expr.
operands().size(),
376 "number of struct components should match with its type");
379 for(std::size_t m = 0; m < expr.
operands().size(); m++)
387 else if(expr.
id() == ID_union)
const union_tag_typet & to_union_tag_type(const typet &type)
Cast a typet to a union_tag_typet.
const componentst & components() const
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
const union_typet & to_union_type(const typet &type)
Cast a typet to a union_typet.
const unsignedbv_typet & to_unsignedbv_type(const typet &type)
Cast a typet to an unsignedbv_typet.
const exprt & skip_typecast(const exprt &expr)
find the expression nested inside typecasts, if any
const struct_typet & to_struct_type(const typet &type)
Cast a typet to a struct_typet.
#define CHECK_RETURN(CONDITION)
The type of an expression, extends irept.
const floatbv_typet & to_floatbv_type(const typet &type)
Cast a typet to a floatbv_typet.
const index_exprt & to_index_expr(const exprt &expr)
Cast an exprt to an index_exprt.
const annotated_pointer_constant_exprt & to_annotated_pointer_constant_expr(const exprt &expr)
Cast an exprt to an annotated_pointer_constant_exprt.
const c_enum_typet & to_c_enum_type(const typet &type)
Cast a typet to a c_enum_typet.
std::unique_ptr< languaget > get_language_from_mode(const irep_idt &mode)
Get the language corresponding to the given mode.
Union constructor from single element.
Base class for all expressions.
std::vector< componentt > componentst
const bv_typet & to_bv_type(const typet &type)
Cast a typet to a bv_typet.
const union_exprt & to_union_expr(const exprt &expr)
Cast an exprt to a union_exprt.
const union_typet & follow_tag(const union_tag_typet &) const
Follow type tag of union type.
auto component(T &struct_expr, const irep_idt &name, const namespacet &ns) -> decltype(struct_expr.op0())
std::string to_string(const string_not_contains_constraintt &expr)
Used for debug printing.
bool is_true() const
Return whether the expression is a constant representing true.
const bitvector_typet & to_bitvector_type(const typet &type)
Cast a typet to a bitvector_typet.
const fixedbv_typet & to_fixedbv_type(const typet &type)
Cast a typet to a fixedbv_typet.
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.
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
const std::string & id2string(const irep_idt &d)
virtual bool from_type(const typet &type, std::string &code, const namespacet &ns)
Formats the given type in a language-specific way.
const c_enum_tag_typet & to_c_enum_tag_type(const typet &type)
Cast a typet to a c_enum_tag_typet.
#define forall_operands(it, expr)
virtual bool from_expr(const exprt &expr, std::string &code, const namespacet &ns)
Formats the given expression in a language-specific way.
const irep_idt & get_identifier() const
const pointer_typet & to_pointer_type(const typet &type)
Cast a typet to a pointer_typet.
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
const irep_idt & id() const
const struct_tag_typet & to_struct_tag_type(const typet &type)
Cast a typet to a struct_tag_typet.
json_arrayt & make_array()
Pointer-typed bitvector constant annotated with the pointer expression that the bitvector is the nume...
const typet & underlying_type() const
const signedbv_typet & to_signedbv_type(const typet &type)
Cast a typet to a signedbv_typet.
std::size_t get_width() const
irep_idt get_component_name() const
const c_bit_field_typet & to_c_bit_field_type(const typet &type)
Cast a typet to a c_bit_field_typet.
Deprecated expression utility functions.
static exprt simplify_json_expr(const exprt &src)
Structure type, corresponds to C style structs.
const typet & follow(const typet &) const
Resolve type symbol to the type it points to.
const typecast_exprt & to_typecast_expr(const exprt &expr)
Cast an exprt to a typecast_exprt.
json_objectt json(const typet &type, const namespacet &ns, const irep_idt &mode)
Output a CBMC type in json.
static std::string binary(const constant_exprt &src)
const array_typet & to_array_type(const typet &type)
Cast a typet to an array_typet.
const vector_typet & to_vector_type(const typet &type)
Cast a typet to a vector_typet.
const member_exprt & to_member_expr(const exprt &expr)
Cast an exprt to a member_exprt.
const address_of_exprt & to_address_of_expr(const exprt &expr)
Cast an exprt to an address_of_exprt.
const std::string integer2binary(const mp_integer &n, std::size_t width)
const typet & underlying_type() const
A constant literal expression.
static jsont json_boolean(bool value)
const irep_idt & get_value() const
exprt & symbolic_pointer()
jsont & push_back(const jsont &json)
std::unique_ptr< languaget > get_default_language()
Returns the default language.
const constant_exprt & to_constant_expr(const exprt &expr)
Cast an exprt to a constant_exprt.