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

@ -50,15 +50,16 @@ namespace elna::gcc
}
static
void declare_builtin_type(std::shared_ptr<symbol_table> symbol_table, const char *name, tree type)
tree declare_builtin_type(std::shared_ptr<symbol_table> symbol_table, const char *name, tree type)
{
tree identifier = get_identifier(name);
tree type_declaration = build_decl(UNKNOWN_LOCATION, TYPE_DECL, identifier, type);
TREE_PUBLIC(type_declaration) = 1;
TYPE_NAME(type_declaration) = identifier;
symbol_table->enter(name, type_declaration);
return type_declaration;
}
std::shared_ptr<symbol_table> builtin_symbol_table()
@ -71,7 +72,10 @@ namespace elna::gcc
declare_builtin_type(symbol_table, "Bool", elna_bool_type_node);
declare_builtin_type(symbol_table, "Byte", elna_byte_type_node);
declare_builtin_type(symbol_table, "Float", elna_float_type_node);
declare_builtin_type(symbol_table, "String", elna_string_type_node);
tree string_declaration = declare_builtin_type(symbol_table, "String", elna_string_type_node);
TYPE_NAME(elna_string_type_node) = DECL_NAME(string_declaration);
TYPE_STUB_DECL(elna_string_type_node) = string_declaration;
return symbol_table;
}