Set STUB_DECL for unique types

This commit is contained in:
2025-04-23 09:28:58 +02:00
parent 09ad85b058
commit a02e053ed2
5 changed files with 28 additions and 16 deletions

View File

@ -862,8 +862,15 @@ namespace elna::gcc
get_identifier(definition->identifier.identifier.c_str()), this->current_expression);
TREE_PUBLIC(definition_tree) = definition->identifier.exported;
TYPE_NAME(this->current_expression) = get_identifier(definition->identifier.identifier.c_str());
if (is_unique_type(this->current_expression))
{
TYPE_NAME(this->current_expression) = DECL_NAME(definition_tree);
TYPE_STUB_DECL(this->current_expression) = definition_tree;
}
else
{
TYPE_NAME(this->current_expression) = definition_tree;
}
auto result = this->symbols->enter(definition->identifier.identifier, definition_tree);
gcc_assert(result);
@ -993,7 +1000,7 @@ namespace elna::gcc
}
tree offset = build2(MINUS_EXPR, elna_word_type_node, this->current_expression, size_one_node);
if (is_array_type(TREE_TYPE(designator)))
if (TREE_CODE(TREE_TYPE(designator)) == ARRAY_TYPE)
{
tree element_type = TREE_TYPE(TREE_TYPE(designator));
@ -1127,12 +1134,12 @@ namespace elna::gcc
location_t expression_location = get_location(&expression->position());
tree aggregate_type = TREE_TYPE(this->current_expression);
if (is_array_type(aggregate_type) && expression->field() == "length")
if (TREE_CODE(aggregate_type) == ARRAY_TYPE && expression->field() == "length")
{
this->current_expression = convert(build_qualified_type(elna_word_type_node, TYPE_QUAL_CONST),
TYPE_MAX_VALUE(TYPE_DOMAIN(aggregate_type)));
}
else if (is_array_type(aggregate_type) && expression->field() == "ptr")
else if (TREE_CODE(aggregate_type) == ARRAY_TYPE && expression->field() == "ptr")
{
tree ptr_type = build_global_pointer_type(TREE_TYPE(aggregate_type));
this->current_expression = build1(ADDR_EXPR,