Use colon instead of as to cast

This commit is contained in:
2025-02-14 08:05:03 +01:00
parent c564847c6b
commit ee4ebf64b9
10 changed files with 488 additions and 290 deletions

View File

@ -62,20 +62,27 @@ namespace gcc
return type == NULL_TREE || type == void_type_node;
}
bool is_record_type(tree type)
bool is_aggregate_type(tree type)
{
return TREE_CODE(type) == RECORD_TYPE;
gcc_assert(TYPE_P(type));
return TREE_CODE(type) == RECORD_TYPE || TREE_CODE(type) == UNION_TYPE;
}
bool are_compatible_pointers(tree lhs, tree rhs)
bool are_compatible_pointers(tree lhs_type, tree rhs)
{
tree lhs_type = TREE_TYPE(lhs);
gcc_assert(TYPE_P(lhs_type));
tree rhs_type = TREE_TYPE(rhs);
return (is_pointer_type(lhs_type) && rhs == elna_pointer_nil_node)
|| (is_pointer_type(lhs_type) && lhs_type == rhs_type);
}
bool is_assignable_from(tree assignee, tree assignment)
{
return TREE_TYPE(assignment) == assignee
|| are_compatible_pointers(assignee, assignment);
}
void append_statement(tree statement_tree)
{
if (!vec_safe_is_empty(f_binding_level->defers))