Restrict cast types

This commit is contained in:
2025-03-21 10:24:57 +01:00
parent 5e8555b4f4
commit 07ed40cc24
7 changed files with 168 additions and 134 deletions

View File

@ -35,7 +35,7 @@ namespace elna::gcc
bool is_integral_type(tree type)
{
gcc_assert(TYPE_P(type));
return TREE_CODE(type) == INTEGER_TYPE;
return TREE_CODE(type) == INTEGER_TYPE && type != elna_char_type_node;
}
bool is_numeric_type(tree type)
@ -43,6 +43,14 @@ namespace elna::gcc
return is_integral_type(type) || type == elna_float_type_node;
}
bool is_primitive_type(tree type)
{
gcc_assert(TYPE_P(type));
return TREE_CODE(type) == INTEGER_TYPE
|| type == elna_float_type_node
|| type == elna_bool_type_node;
}
bool is_array_type(tree type)
{
gcc_assert(TYPE_P(type));