9 #ifndef CPROVER_UTIL_C_TYPES_UTIL_H
10 #define CPROVER_UTIL_C_TYPES_UTIL_H
29 (c_type == ID_char || c_type == ID_unsigned_char ||
30 c_type == ID_signed_char);
37 return type.
id() == ID_c_bool;
48 (c_type == ID_signed_int || c_type == ID_unsigned_int ||
49 c_type == ID_signed_short_int || c_type == ID_unsigned_int ||
50 c_type == ID_unsigned_short_int || c_type == ID_signed_long_int ||
51 c_type == ID_signed_long_long_int || c_type == ID_unsigned_long_int ||
52 c_type == ID_unsigned_long_long_int);
59 return type.
id() == ID_pointer &&
68 return type.
id() == ID_pointer &&
76 return type.
id() == ID_c_enum;
89 for(
const auto &enum_value : c_enum.
members())
91 if(enum_value.get_identifier() == member_name)
93 auto maybe_int_value = numeric_cast<mp_integer>(
99 INVARIANT(
false,
"member_name must be a valid value in the c_enum.");
107 std::string string_value = bool_value;
109 string_value.begin(), string_value.end(), string_value.begin(), ::
tolower);
110 if(string_value ==
"true")
112 if(string_value ==
"false")
static abstract_object_pointert transform(const exprt &expr, const std::vector< abstract_object_pointert > &operands, const abstract_environmentt &environment, const namespacet &ns)
bool is_signed_or_unsigned_bitvector(const typet &type)
This method tests, if the given typet is a signed or unsigned bitvector.
bool is_c_char_pointer_type(const typet &type)
This function checks, whether type is a pointer and the target type of the pointer has been a char ty...
bool is_c_integral_type(const typet &type)
This function checks, whether the type has been some kind of integer type in the c program.
bool is_c_integral_pointer_type(const typet &type)
This function checks, whether type is a pointer and the target type has been some kind of int type in...
bool is_c_enum_type(const typet &type)
This function checks, whether the type has been an enum type in the c program.
bool id2boolean(const std::string &bool_value)
Convert id to a Boolean value.
bool is_c_bool_type(const typet &type)
This function checks, whether the type has been a bool type in the c program.
constant_exprt from_c_boolean_value(bool bool_value, const typet &type)
This function creates a constant representing either 0 or 1 as value of type type.
constant_exprt convert_member_name_to_enum_value(const irep_idt &member_name, const c_enum_typet &c_enum)
This function creates a constant representing the bitvector encoded integer value of a string in the ...
bool is_c_char_type(const typet &type)
This function checks, whether this has been a char type in the c program.
A constant literal expression.
const irep_idt & get_value() const
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
const irep_idt & get(const irep_idt &name) const
const irep_idt & id() const
The type of an expression, extends irept.
const pointer_typet & to_pointer_type(const typet &type)
Cast a typet to a pointer_typet.
#define CHECK_RETURN(CONDITION)
#define UNREACHABLE
This should be used to mark dead code.
#define INVARIANT(CONDITION, REASON)
This macro uses the wrapper function 'invariant_violated_string'.
Defines typet, type_with_subtypet and type_with_subtypest.