Rizin
unix-like reverse engineering framework and cli tools
|
Go to the source code of this file.
RZ_API RZ_OWN RzType* rz_type_array_of_base_type | ( | const RzTypeDB * | typedb, |
RZ_NONNULL const RzBaseType * | btype, | ||
size_t | count | ||
) |
Creates a new array RzType from the given RzBaseType.
typedb | Type Database instance |
btype | RzBaseType pointer |
count | The number of the array elements |
Definition at line 124 of file helpers.c.
References count, NULL, RZ_NEW0, rz_type_free(), rz_type_identifier_of_base_type(), RZ_TYPE_KIND_ARRAY, and type.
Referenced by rz_type_array_of_base_type_str().
RZ_API RZ_OWN RzType* rz_type_array_of_base_type_str | ( | const RzTypeDB * | typedb, |
RZ_NONNULL const char * | name, | ||
size_t | count | ||
) |
Creates a new array RzType from the given RzBaseType name.
typedb | Type Database instance |
name | RzBaseType name |
count | The number of the array elements |
Definition at line 147 of file helpers.c.
References count, NULL, rz_return_val_if_fail, rz_type_array_of_base_type(), and rz_type_db_get_base_type().
RZ_API RZ_OWN RzType* rz_type_array_of_type | ( | const RzTypeDB * | typedb, |
RZ_NONNULL RzType * | type, | ||
size_t | count | ||
) |
Creates a new array RzType from the given RzType.
typedb | Type Database instance |
type | RzType pointer |
count | The number of the array elements |
Definition at line 163 of file helpers.c.
References rz_type_t::array, count, rz_type_t::kind, NULL, RZ_NEW0, RZ_TYPE_KIND_ARRAY, and type.
RZ_API bool rz_type_atomic_eq | ( | const RzTypeDB * | typedb, |
RZ_NONNULL const RzType * | typ1, | ||
RZ_NONNULL const RzType * | typ2 | ||
) |
Checks if two atomic RzTypes are equivalent.
typedb | Type Database instance |
typ1 | First RzType type |
typ2 | Second RzType type |
Definition at line 183 of file helpers.c.
References rz_base_type_t::kind, rz_base_type_t::name, RZ_BASE_TYPE_KIND_ATOMIC, rz_return_val_if_fail, rz_type_db_get_base_type(), RZ_TYPE_IDENTIFIER_KIND_UNSPECIFIED, RZ_TYPE_KIND_IDENTIFIER, and rz_base_type_t::size.
Checks if the atomic RzType is "const".
typedb | Type Database instance |
type | RzType type pointer |
Definition at line 246 of file helpers.c.
References rz_return_val_if_fail, RZ_TYPE_KIND_IDENTIFIER, and type.
Checks if the RzType is "void".
typedb | Type Database instance |
type | RzType type pointer |
Definition at line 232 of file helpers.c.
References rz_return_val_if_fail, RZ_TYPE_KIND_IDENTIFIER, and type.
Referenced by var_type_set().
RZ_API bool rz_type_atomic_str_eq | ( | const RzTypeDB * | typedb, |
RZ_NONNULL const RzType * | typ1, | ||
RZ_NONNULL const char * | name | ||
) |
Checks if two atomic types (RzType and RzBaseType) are equivalent.
typedb | Type Database instance |
typ1 | First RzType type |
typ2 | Second RzBaseType type name |
Definition at line 208 of file helpers.c.
References rz_base_type_t::kind, rz_base_type_t::name, RZ_BASE_TYPE_KIND_ATOMIC, rz_return_val_if_fail, rz_type_db_get_base_type(), RZ_TYPE_IDENTIFIER_KIND_UNSPECIFIED, RZ_TYPE_KIND_IDENTIFIER, and rz_base_type_t::size.
Referenced by rz_core_analysis_var_display().
RZ_API bool rz_type_cond_eval | ( | RzTypeCond | cond, |
st64 | arg0, | ||
st64 | arg1 | ||
) |
evaluate the type condition on the arguments and return a bool accordingly.
cond | RzTypeCond |
arg0 | |
arg1 |
Definition at line 534 of file helpers.c.
References cond, RZ_TYPE_COND_EQ, RZ_TYPE_COND_GE, RZ_TYPE_COND_GT, RZ_TYPE_COND_LE, RZ_TYPE_COND_LT, and RZ_TYPE_COND_NE.
Referenced by rz_analysis_cond_eval().
RZ_API bool rz_type_cond_eval_single | ( | RzTypeCond | cond, |
st64 | arg0 | ||
) |
Same as rz_type_cond_eval, but it assumes arg1
to be 0.
cond | RzTypeCond |
arg0 |
Definition at line 554 of file helpers.c.
References cond, RZ_TYPE_COND_EQ, RZ_TYPE_COND_GE, RZ_TYPE_COND_GT, RZ_TYPE_COND_LE, RZ_TYPE_COND_LT, and RZ_TYPE_COND_NE.
Referenced by rz_analysis_cond_eval().
RZ_API RzTypeCond rz_type_cond_invert | ( | RzTypeCond | cond | ) |
return the inverted condition
cond | RzTypeCond |
Definition at line 504 of file helpers.c.
References cond, RZ_TYPE_COND_AL, RZ_TYPE_COND_EQ, RZ_TYPE_COND_GE, RZ_TYPE_COND_GT, RZ_TYPE_COND_LE, RZ_TYPE_COND_LT, RZ_TYPE_COND_NE, RZ_TYPE_COND_NV, and rz_warn_if_reached.
Referenced by propagate_types_among_used_variables().
RZ_API RZ_BORROW const char* rz_type_cond_tostring | ( | RzTypeCond | cc | ) |
RzTypeCond enum to string.
cc | RzTypeCond |
Definition at line 471 of file helpers.c.
References RZ_TYPE_COND_AL, RZ_TYPE_COND_EQ, RZ_TYPE_COND_EXCEPTION, RZ_TYPE_COND_GE, RZ_TYPE_COND_GT, RZ_TYPE_COND_HEX_SCL_FALSE, RZ_TYPE_COND_HEX_SCL_TRUE, RZ_TYPE_COND_HEX_VEC_FALSE, RZ_TYPE_COND_HEX_VEC_TRUE, RZ_TYPE_COND_HI, RZ_TYPE_COND_HS, RZ_TYPE_COND_LE, RZ_TYPE_COND_LO, RZ_TYPE_COND_LS, RZ_TYPE_COND_LT, RZ_TYPE_COND_MI, RZ_TYPE_COND_NE, RZ_TYPE_COND_NV, RZ_TYPE_COND_PL, RZ_TYPE_COND_VC, and RZ_TYPE_COND_VS.
Referenced by core_analysis_bytes_json(), and core_analysis_bytes_standard().
RZ_API RZ_OWN RzType* rz_type_identifier_of_base_type | ( | const RzTypeDB * | typedb, |
RZ_NONNULL const RzBaseType * | btype, | ||
bool | is_const | ||
) |
Creates a new RzType indentifier from the given RzBaseType.
typedb | Type Database instance |
btype | RzBaseType pointer |
is_const | Set the identifier to "const" if true |
Definition at line 15 of file helpers.c.
References NULL, RZ_BASE_TYPE_KIND_ENUM, RZ_BASE_TYPE_KIND_STRUCT, RZ_BASE_TYPE_KIND_UNION, RZ_NEW0, rz_return_val_if_fail, RZ_TYPE_IDENTIFIER_KIND_ENUM, RZ_TYPE_IDENTIFIER_KIND_STRUCT, RZ_TYPE_IDENTIFIER_KIND_UNION, RZ_TYPE_IDENTIFIER_KIND_UNSPECIFIED, RZ_TYPE_KIND_IDENTIFIER, strdup(), and type.
Referenced by rz_analysis_function_blocks_switch_type_handler(), rz_type_array_of_base_type(), rz_type_db_base_type_as_pretty_string(), rz_type_db_base_type_as_string(), rz_type_identifier_of_base_type_str(), rz_type_integral_set_sign(), rz_type_new_default(), rz_type_path_by_offset(), and rz_type_pointer_of_base_type().
RZ_API RZ_OWN RzType* rz_type_identifier_of_base_type_str | ( | const RzTypeDB * | typedb, |
RZ_NONNULL const char * | name | ||
) |
Creates a new RzType indentifier from the given RzBaseType name.
typedb | Type Database instance |
name | RzBaseType name |
Definition at line 47 of file helpers.c.
References NULL, rz_return_val_if_fail, rz_type_db_get_base_type(), and rz_type_identifier_of_base_type().
Referenced by path_walker().
RZ_API bool rz_type_integral_set_sign | ( | const RzTypeDB * | typedb, |
RZ_NONNULL RzType ** | type, | ||
bool | sign | ||
) |
If the type is unsigned it sets the sign.
typedb | Type Database instance |
type | RzType type pointer |
Definition at line 430 of file helpers.c.
References rz_type_t::kind, rz_base_type_typeclass(), rz_return_val_if_fail, rz_type_db_base_get_bitsize(), rz_type_db_get_base_type(), rz_type_free(), rz_type_identifier(), rz_type_identifier_of_base_type(), rz_type_is_integral(), RZ_TYPE_KIND_IDENTIFIER, rz_type_typeclass_get_default_sized(), RZ_TYPE_TYPECLASS_INTEGRAL_SIGNED, RZ_TYPE_TYPECLASS_INTEGRAL_UNSIGNED, and type.
Referenced by var_type_set_sign().
Checks if the RzType is atomic or derivative of it.
typedb | Type Database instance |
type | RzType type pointer |
Definition at line 371 of file helpers.c.
References rz_base_type_t::kind, RZ_BASE_TYPE_KIND_ATOMIC, rz_return_val_if_fail, rz_type_db_get_base_type(), RZ_TYPE_IDENTIFIER_KIND_UNSPECIFIED, RZ_TYPE_KIND_ARRAY, RZ_TYPE_KIND_IDENTIFIER, RZ_TYPE_KIND_POINTER, and type.
Referenced by base_type_to_format_unfold().
RZ_API bool rz_type_is_char_ptr | ( | RZ_NONNULL const RzType * | type | ) |
Checks if the pointer RzType is a string ("char *" or "const char *")
type | RzType type pointer |
Definition at line 318 of file helpers.c.
References rz_return_val_if_fail, type, and type_is_atomic_ptr().
Referenced by rz_type_as_format().
RZ_API bool rz_type_is_char_ptr_nested | ( | RZ_NONNULL const RzType * | type | ) |
Checks if the pointer RzType is a nested pointer of string ("char **", "char ***", etc)
type | RzType type pointer |
Definition at line 328 of file helpers.c.
References rz_return_val_if_fail, type, and type_is_atomic_ptr_nested().
Referenced by var_type_simple_to_complex().
Checks if the RzType is default.
typedb | Type Database instance |
type | RzType type pointer |
Definition at line 399 of file helpers.c.
References rz_type_target_t::default_type, rz_return_val_if_fail, RZ_TYPE_IDENTIFIER_KIND_UNSPECIFIED, RZ_TYPE_KIND_IDENTIFIER, rz_type_db_t::target, and type.
Referenced by var_type_set().
RZ_API bool rz_type_is_identifier | ( | RZ_NONNULL const RzType * | type | ) |
Checks if the RzType is identifier.
type | RzType type pointer |
Definition at line 338 of file helpers.c.
References rz_return_val_if_fail, RZ_TYPE_KIND_IDENTIFIER, and type.
Referenced by base_type_to_format_unfold().
Checks if the RzType is strictly atomic.
typedb | Type Database instance |
type | RzType type pointer |
Definition at line 349 of file helpers.c.
References rz_base_type_t::kind, RZ_BASE_TYPE_KIND_ATOMIC, rz_return_val_if_fail, rz_type_db_get_base_type(), RZ_TYPE_IDENTIFIER_KIND_UNSPECIFIED, RZ_TYPE_KIND_IDENTIFIER, and type.
Referenced by rz_analysis_var_resolve_overlaps(), and rz_core_analysis_var_display().
RZ_API bool rz_type_is_void_ptr | ( | RZ_NONNULL const RzType * | type | ) |
Checks if the pointer RzType is abstract pointer ("void *")
type | RzType type pointer |
Definition at line 298 of file helpers.c.
References rz_return_val_if_fail, type, and type_is_atomic_ptr().
Referenced by rz_type_as_format(), and var_type_set().
RZ_API bool rz_type_is_void_ptr_nested | ( | RZ_NONNULL const RzType * | type | ) |
Checks if the pointer RzType is a nested abstract pointer ("void **", "vpod ***", etc)
type | RzType type pointer |
Definition at line 308 of file helpers.c.
References rz_return_val_if_fail, type, and type_is_atomic_ptr_nested().
Creates a new instance of the default RzType type.
typedb | Type Database instance |
Definition at line 415 of file helpers.c.
References rz_type_target_t::default_type, NULL, rz_return_val_if_fail, rz_type_db_get_base_type(), rz_type_identifier_of_base_type(), and rz_type_db_t::target.
Checks if the pointer RzType is "const".
typedb | Type Database instance |
type | RzType type pointer |
Definition at line 260 of file helpers.c.
References rz_return_val_if_fail, RZ_TYPE_KIND_POINTER, and type.
RZ_API RZ_OWN RzType* rz_type_pointer_of_base_type | ( | const RzTypeDB * | typedb, |
RZ_NONNULL const RzBaseType * | btype, | ||
bool | is_const | ||
) |
Creates a new pointer RzType from the given RzBaseType.
typedb | Type Database instance |
btype | RzBaseType pointer |
is_const | Set the pointer to "const" if true |
Definition at line 63 of file helpers.c.
References NULL, RZ_NEW0, rz_type_free(), rz_type_identifier_of_base_type(), RZ_TYPE_KIND_POINTER, and type.
Referenced by rz_type_pointer_of_base_type_str().
RZ_API RZ_OWN RzType* rz_type_pointer_of_base_type_str | ( | const RzTypeDB * | typedb, |
RZ_NONNULL const char * | name, | ||
bool | is_const | ||
) |
Creates a new pointer RzType from the given RzBaseType name.
typedb | Type Database instance |
name | RzBaseType name |
is_const | Set the pointer to "const" if true |
Definition at line 86 of file helpers.c.
References NULL, rz_return_val_if_fail, rz_type_db_get_base_type(), and rz_type_pointer_of_base_type().
Referenced by rz_type_pointer_of_type().
RZ_API RZ_OWN RzType* rz_type_pointer_of_type | ( | const RzTypeDB * | typedb, |
RZ_NONNULL RzType * | type, | ||
bool | is_const | ||
) |
Creates a new pointer RzType from the given RzType.
typedb | Type Database instance |
type | RzType pointer |
is_const | Set the pointer to "const" if true |
Definition at line 102 of file helpers.c.
References rz_type_t::kind, NULL, rz_type_t::pointer, RZ_NEW0, rz_return_val_if_fail, RZ_TYPE_KIND_IDENTIFIER, RZ_TYPE_KIND_POINTER, rz_type_pointer_of_base_type_str(), and type.
Referenced by var_type_set().
|
static |
Definition at line 268 of file helpers.c.
References rz_type_t::identifier, rz_type_t::kind, rz_return_val_if_fail, RZ_TYPE_IDENTIFIER_KIND_UNSPECIFIED, RZ_TYPE_KIND_IDENTIFIER, RZ_TYPE_KIND_POINTER, and type.
Referenced by rz_type_is_char_ptr(), and rz_type_is_void_ptr().
|
static |
Definition at line 279 of file helpers.c.
References rz_type_t::identifier, rz_type_t::kind, rz_return_val_if_fail, RZ_TYPE_IDENTIFIER_KIND_UNSPECIFIED, RZ_TYPE_KIND_IDENTIFIER, RZ_TYPE_KIND_POINTER, and type.
Referenced by rz_type_is_char_ptr_nested(), and rz_type_is_void_ptr_nested().