Go to the documentation of this file.
10 #ifndef CPROVER_UTIL_C_TYPES_H
11 #define CPROVER_UTIL_C_TYPES_H
47 return type.
id() == ID_c_bit_field;
95 return type.
id() == ID_c_bool;
151 return type.
id() == ID_union;
191 return type.
id() == ID_union_tag;
229 return get(ID_value);
233 set(ID_value, value);
237 return get(ID_identifier);
241 set(ID_identifier, identifier);
245 return get(ID_base_name);
249 set(ID_base_name, base_name);
269 set(ID_incomplete,
true);
291 return type.
id() == ID_c_enum;
333 return type.
id() == ID_c_enum_tag;
365 :
code_typet(std::move(_parameters), std::move(_return_type))
378 return static_cast<const exprt &
>(
find(ID_C_spec_assigns)).operands();
383 return static_cast<exprt &
>(
add(ID_C_spec_assigns)).operands();
388 return static_cast<const exprt &
>(
find(ID_C_spec_requires_contract))
394 return static_cast<exprt &
>(
add(ID_C_spec_requires_contract)).operands();
399 return static_cast<const exprt &
>(
find(ID_C_spec_requires)).operands();
404 return static_cast<exprt &
>(
add(ID_C_spec_requires)).operands();
409 return static_cast<const exprt &
>(
find(ID_C_spec_ensures_contract))
415 return static_cast<exprt &
>(
add(ID_C_spec_ensures_contract)).operands();
420 return static_cast<const exprt &
>(
find(ID_C_spec_ensures)).operands();
425 return static_cast<exprt &
>(
add(ID_C_spec_ensures)).operands();
435 return type.
id() == ID_code;
463 SINCE(2022, 1, 13,
"use c_index_type() or array_typet::index_type() instead"))
502 #endif // CPROVER_UTIL_C_TYPES_H
const union_tag_typet & to_union_tag_type(const typet &type)
Cast a typet to a union_tag_typet.
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
exprt::operandst & assigns()
const union_typet & to_union_type(const typet &type)
Cast a typet to a union_typet.
const code_with_contract_typet & to_code_with_contract_type(const typet &type)
Cast a typet to a code_with_contract_typet.
#define DATA_CHECK(vm, condition, message)
This macro takes a condition which denotes a well-formedness criterion on goto programs,...
const typet & subtype() const
const c_bool_typet & to_c_bool_type(const typet &type)
Cast a typet to a c_bool_typet.
c_enum_typet(typet _subtype)
void set_value(const irep_idt &value)
std::string c_type_as_string(const irep_idt &)
bool is_incomplete() const
enum types may be incomplete
bitvector_typet c_index_type()
The type of an expression, extends irept.
std::vector< parametert > parameterst
c_bit_field_typet(typet _subtype, std::size_t width)
optionalt< std::pair< struct_union_typet::componentt, mp_integer > > find_widest_union_component(const namespacet &ns) const
Determine the member of maximum bit width in a union type.
unsignedbv_typet char32_t_type()
static void check(const typet &type, const validation_modet vm=validation_modet::INVARIANT)
const irept & find(const irep_idt &name) const
Base type for structs and unions.
bool can_cast_type< union_tag_typet >(const typet &type)
Check whether a reference to a typet is a union_tag_typet.
std::vector< c_enum_membert > memberst
bool can_cast_type< c_bool_typet >(const typet &type)
Check whether a reference to a typet is a c_bool_typet.
floatbv_typet double_type()
Fixed-width bit-vector with IEEE floating-point interpretation.
const c_enum_typet & to_c_enum_type(const typet &type)
Cast a typet to a c_enum_typet.
bitvector_typet char_type()
Base class for all expressions.
std::vector< componentt > componentst
void make_incomplete()
enum types may be incomplete
bitvector_typet enum_constant_type()
unsignedbv_typet size_type()
Type with a single subtype.
irep_idt get_base_name() const
const exprt::operandst & ensures_contract() const
reference_typet reference_type(const typet &)
const exprt::operandst & assigns() const
A union tag type, i.e., union_typet with an identifier.
Fixed-width bit-vector with unsigned binary interpretation.
const irep_idt & get(const irep_idt &name) const
union_typet(componentst _components)
unsignedbv_typet unsigned_long_int_type()
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Type for C bit fields These are both 'bitvector_typet' (they have a width) and 'type_with_subtypet' (...
bool can_cast_type< c_enum_tag_typet >(const typet &type)
Check whether a reference to a typet is a c_enum_tag_typet.
bool can_cast_type< code_with_contract_typet >(const typet &type)
Check whether a reference to a typet is a code_typet.
floatbv_typet float_type()
const c_enum_tag_typet & to_c_enum_tag_type(const typet &type)
Cast a typet to a c_enum_tag_typet.
void set(const irep_idt &name, const irep_idt &value)
#define PRECONDITION(CONDITION)
signedbv_typet signed_char_type()
floatbv_typet long_double_type()
Fixed-width bit-vector with two's complement interpretation.
code_with_contract_typet(parameterst _parameters, typet _return_type)
Constructs a new 'code with contract' type, i.e., a function type decorated with a function contract.
unsignedbv_typet unsigned_long_long_int_type()
c_bool_typet(std::size_t width)
exprt::operandst & ensures()
bool can_cast_type< c_enum_typet >(const typet &type)
Check whether a reference to a typet is a c_enum_typet.
signedbv_typet pointer_diff_type()
void set_identifier(const irep_idt &identifier)
typet & underlying_type()
const irep_idt & id() const
std::vector< exprt > operandst
A tag-based type, i.e., typet with an identifier.
bool can_cast_type< union_typet >(const typet &type)
Check whether a reference to a typet is a union_typet.
bitvector_typet c_enum_constant_type()
return type of enum constants
static void check(const typet &, const validation_modet=validation_modet::INVARIANT)
Check that the type is well-formed (shallow checks only, i.e., subtypes are not checked)
#define SINCE(year, month, day, msg)
nonstd::optional< T > optionalt
const exprt::operandst & requires_contract() const
irep_idt get_value() const
const typet & underlying_type() const
exprt::operandst & ensures_contract()
const c_bit_field_typet & to_c_bit_field_type(const typet &type)
Cast a typet to a c_bit_field_typet.
c_enum_tag_typet(const irep_idt &identifier)
signedbv_typet signed_size_type()
bool has_contract() const
unsignedbv_typet unsigned_int_type()
irept & add(const irep_idt &name)
C enum tag type, i.e., c_enum_typet with an identifier.
void set_base_name(const irep_idt &base_name)
Base class of fixed-width bit-vector types.
unsignedbv_typet char16_t_type()
signedbv_typet signed_long_long_int_type()
bitvector_typet index_type()
const exprt::operandst & ensures() const
unsignedbv_typet unsigned_char_type()
exprt::operandst & requires()
signedbv_typet signed_long_int_type()
unsignedbv_typet unsigned_short_int_type()
union_tag_typet(const irep_idt &identifier)
const typet & subtype() const
There are a large number of kinds of tree structured or tree-like data in CPROVER.
irep_idt get_identifier() const
signedbv_typet signed_short_int_type()
pointer_typet pointer_type(const typet &)
signedbv_typet signed_int_type()
bitvector_typet wchar_t_type()
const typet & underlying_type() const
The pointer type These are both 'bitvector_typet' (they have a width) and 'type_with_subtypet' (they ...
typet & underlying_type()
exprt::operandst & requires_contract()
const exprt::operandst & requires() const
bool get_bool(const irep_idt &name) const
static void check(const typet &type, const validation_modet vm=validation_modet::INVARIANT)
const memberst & members() const
bool can_cast_type< c_bit_field_typet >(const typet &type)
Check whether a reference to a typet is a c_bit_field_typet.