Make array ptr and length properties constant

This commit is contained in:
2025-03-24 11:11:18 +01:00
parent 6ccb195c09
commit c022805c53
4 changed files with 118 additions and 112 deletions

View File

@ -44,39 +44,41 @@ namespace elna::gcc
{
gcc_assert(TYPE_P(type));
if (type == elna_int_type_node)
tree unqualified_type = get_qualified_type(type, TYPE_UNQUALIFIED);
if (unqualified_type == elna_int_type_node)
{
return "Int";
}
else if (type == elna_word_type_node)
else if (unqualified_type == elna_word_type_node)
{
return "Word";
}
else if (type == elna_bool_type_node)
else if (unqualified_type == elna_bool_type_node)
{
return "Bool";
}
else if (type == elna_byte_type_node)
else if (unqualified_type == elna_byte_type_node)
{
return "Byte";
}
else if (type == elna_float_type_node)
else if (unqualified_type == elna_float_type_node)
{
return "Float";
}
else if (type == elna_char_type_node)
else if (unqualified_type == elna_char_type_node)
{
return "Char";
}
else if (type == elna_string_type_node)
else if (unqualified_type == elna_string_type_node)
{
return "String";
}
else if (is_void_type(type)) // For procedures without a return type.
else if (is_void_type(unqualified_type)) // For procedures without a return type.
{
return "()";
}
else if (is_pointer_type(type))
else if (is_pointer_type(unqualified_type))
{
tree pointer_target_type = TREE_TYPE(type);
@ -107,23 +109,25 @@ namespace elna::gcc
}
}
output += ')';
if (!is_void_type(TREE_TYPE(type)))
tree return_type = TREE_TYPE(type);
if (!is_void_type(return_type))
{
output += " -> " + print_type(TREE_TYPE(type));
output += " -> " + print_type(return_type);
}
return output;
}
else if (is_array_type(type))
else if (is_array_type(unqualified_type))
{
return "array";
}
else if (TREE_CODE(type) == RECORD_TYPE)
{
return print_aggregate_name(type, "record");
return print_aggregate_name(unqualified_type, "record");
}
else if (TREE_CODE(type) == UNION_TYPE)
{
return print_aggregate_name(type, "union");
return print_aggregate_name(unqualified_type, "union");
}
else
{