Implement .max and .min type properties

This commit is contained in:
2025-02-16 07:53:31 +01:00
parent b358f8ba27
commit 994b91e0e5
5 changed files with 290 additions and 277 deletions

View File

@ -30,6 +30,18 @@ namespace gcc
return linemap_position_for_column(line_table, position->column);
}
std::string print_aggregate_name(tree type, const std::string& kind_name)
{
if (TYPE_IDENTIFIER(type) == NULL_TREE)
{
return kind_name;
}
else
{
return std::string(IDENTIFIER_POINTER(TYPE_IDENTIFIER(type)));
}
}
std::string print_type(tree type)
{
gcc_assert(TYPE_P(type));
@ -68,7 +80,7 @@ namespace gcc
}
else if (is_pointer_type(type))
{
return std::string("pointer to " + print_type(TREE_TYPE(type)));
return std::string("^" + print_type(TREE_TYPE(type)));
}
else if (is_procedure_type(type))
{
@ -100,11 +112,11 @@ namespace gcc
}
else if (TREE_CODE(type) == RECORD_TYPE)
{
return "record";
return print_aggregate_name(type, "record");
}
else if (TREE_CODE(type) == UNION_TYPE)
{
return "union";
return print_aggregate_name(type, "union");
}
else
{