diff options
| author | Eugen Wissner <belka@caraus.de> | 2026-07-14 01:45:58 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2026-07-14 01:45:58 +0200 |
| commit | 51e2f98e33ae10fc3052335cc6847bc93d0784fa (patch) | |
| tree | 7588effe2778d38d19adbf83cf23b5429df93691 /gcc | |
| parent | 8ceb48a4e60b8ff89f28372da4f66cd152e2e0fe (diff) | |
| download | elna-51e2f98e33ae10fc3052335cc6847bc93d0784fa.tar.gz | |
Add static array initializer
Diffstat (limited to 'gcc')
| -rw-r--r-- | gcc/gcc/elna-generic.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/gcc/elna-generic.cc b/gcc/gcc/elna-generic.cc index 5749bbc..928ca8d 100644 --- a/gcc/gcc/elna-generic.cc +++ b/gcc/gcc/elna-generic.cc @@ -202,6 +202,28 @@ namespace elna::gcc this->current_expression = build_constructor(record_type, tree_arguments); } + void generic_visitor::visit(boot::array_constructor_expression *expression) + { + tree array_type = get_inner_alias(expression->type_decoration, this->symbols); + + if (TREE_CODE(array_type) != ARRAY_TYPE) + { + this->current_expression = error_mark_node; + return; + } + tree domain = TYPE_DOMAIN(array_type); + tree index = TYPE_MIN_VALUE(domain); + vec<constructor_elt, va_gc> *tree_arguments = nullptr; + + for (boot::expression *const element : expression->elements) + { + element->accept(this); + CONSTRUCTOR_APPEND_ELT(tree_arguments, index, this->current_expression); + index = int_const_binop(PLUS_EXPR, index, size_one_node); + } + this->current_expression = build_constructor(array_type, tree_arguments); + } + void generic_visitor::visit(boot::unit *unit) { for (boot::import_declaration *const declaration : unit->imports) |
