diff options
Diffstat (limited to 'gcc')
| -rw-r--r-- | gcc/gcc/elna-generic.cc | 31 |
1 files changed, 6 insertions, 25 deletions
diff --git a/gcc/gcc/elna-generic.cc b/gcc/gcc/elna-generic.cc index 79207cc..8561ac4 100644 --- a/gcc/gcc/elna-generic.cc +++ b/gcc/gcc/elna-generic.cc @@ -39,6 +39,8 @@ namespace elna::gcc generic_visitor::generic_visitor(std::shared_ptr<symbol_table> symbol_table, boot::symbol_bag bag, const boot::target_info& target) : bag(bag), symbols(symbol_table), target(target) + , const_evaluator(std::make_unique<boot::evaluator>(this->bag, this->target, + this->evaluated_initializers)) { } @@ -862,34 +864,13 @@ namespace elna::gcc { location_t trait_location = get_location(&trait->position()); - if (trait->name == "size") + if (trait->name == "size" || trait->name == "alignment" + || trait->name == "min" || trait->name == "max") { if (expect_trait_type_only(trait)) { - this->current_expression = fold_convert_loc(trait_location, elna_word_type_node, - size_in_bytes(this->current_expression)); - } - } - else if (trait->name == "alignment") - { - if (expect_trait_type_only(trait)) - { - this->current_expression = build_int_cstu(elna_word_type_node, - TYPE_ALIGN_UNIT(this->current_expression)); - } - } - else if (trait->name == "min") - { - if (expect_trait_type_only(trait)) - { - this->current_expression = TYPE_MIN_VALUE(this->current_expression); - } - } - else if (trait->name == "max") - { - if (expect_trait_type_only(trait)) - { - this->current_expression = TYPE_MAX_VALUE(this->current_expression); + this->current_expression = constant_to_tree( + *this->const_evaluator->evaluate_traits(*trait)); } } else if (trait->name == "offset") |
