Repository navigation
WIP: Initial support for C++26 enumerating expansion statements (IL CHANGE) [GH #216] #477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
6ea85ca
c3b869d
49b9492
00d382c
c23deda
1e8cd52
30f0562
5ba7f3f
5703b55
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20304,6 +20304,58 @@ Generate code for the indicated range-based-for statement. | |
| gen_statement(statement->variant.range_based_for_loop.statement); | ||
| } /* gen_range_based_for_statement */ | ||
|
|
||
|
|
||
| static void gen_expansion_statement(a_statement_ptr statement) | ||
| /* | ||
| Generate code for the indicated expansion statement. | ||
| */ | ||
| { | ||
| an_expansion_stmt_info_ptr expn_info = expn_info_of(statement); | ||
|
|
||
| if (expn_info->expansion_scope != NULL) { | ||
| push_name_context(expn_info->expansion_scope); | ||
| } /* if */ | ||
| write_tok_str("template for ("); | ||
| if (expn_info->initialization != NULL) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| /* Generate the initialization statement. */ | ||
| gen_init_statement_or_statement( | ||
| get_for_init_statement(expn_info->initialization)); | ||
| } /* if */ | ||
| gen_variable_decl(/*is_condition=*/FALSE, /*is_iterator=*/TRUE, | ||
| /*for_init=*/FALSE, /*suppress_specifiers=*/FALSE, | ||
| (a_boolean *)NULL); | ||
| write_tok_str(" : "); | ||
| if (expn_info->initializer_is_list) { | ||
| /* Generate the initializer list. */ | ||
| write_tok_ch('{'); | ||
| for (an_expr_node_ptr expr = expn_info->initializer; | ||
| expr != NULL; | ||
| expr = expr->next) { | ||
| if (expr != expn_info->initializer) { | ||
| write_tok_str(", "); | ||
| } /* if */ | ||
| gen_expr(expr, /*need_parens=*/expr_has_comma_operation(expr), | ||
| /*obj_expr_of_mfunc_operator=*/FALSE); | ||
| } /* for */ | ||
| write_tok_ch('}'); | ||
| } else { | ||
| /* Generate the initializer expression. */ | ||
| check_assertion(expn_info->initializer != NULL); | ||
| gen_expression(expn_info->initializer); | ||
| } /* if */ | ||
| write_tok_str(") "); | ||
| /* The body is a template definition even outside an ordinary template; | ||
| generate it in prototype form. */ | ||
| Value_saver<a_boolean> prototype_context_saver( | ||
| &in_prototype_instantiation_context, TRUE); | ||
| if (expn_info->iterator_scope != NULL) { | ||
| push_name_context(expn_info->iterator_scope); | ||
| } /* if */ | ||
| gen_statement(statement->variant.expansion_statement.statement); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| if (expn_info->iterator_scope != NULL) pop_name_context(); | ||
| if (expn_info->expansion_scope != NULL) pop_name_context(); | ||
| } /* gen_expansion_statement */ | ||
|
|
||
| #if MICROSOFT_EXTENSIONS_ALLOWED | ||
|
|
||
| static void gen_for_each_statement(a_statement_ptr statement) | ||
|
|
@@ -22651,6 +22703,10 @@ one that yields the value) of a statement expression. | |
| /* range-based-for statement. */ | ||
| gen_range_based_for_statement(statement); | ||
| break; | ||
| case stmk_expansion_statement: | ||
| /* Expansion statement. */ | ||
| gen_expansion_statement(statement); | ||
| break; | ||
| #if MICROSOFT_EXTENSIONS_ALLOWED | ||
| case stmk_for_each: | ||
| /* "for each" statement. */ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Script executed:
Repository: edgcpp/compiler
Length of output: 16692
Script executed:
Repository: edgcpp/compiler
Length of output: 37368
Script executed:
Repository: edgcpp/compiler
Length of output: 34141
Script executed:
Repository: edgcpp/compiler
Length of output: 35451
Script executed:
Repository: edgcpp/compiler
Length of output: 24280
Script executed:
Repository: edgcpp/compiler
Length of output: 17797
Script executed:
Repository: edgcpp/compiler
Length of output: 20294
Script executed:
Repository: edgcpp/compiler
Length of output: 19709
Script executed:
Repository: edgcpp/compiler
Length of output: 10130
Script executed:
Repository: edgcpp/compiler
Length of output: 19827
Script executed:
Repository: edgcpp/compiler
Length of output: 10197
Script executed:
Repository: edgcpp/compiler
Length of output: 25550
Script executed:
Repository: edgcpp/compiler
Length of output: 14488
Script executed:
Repository: edgcpp/compiler
Length of output: 13062
Script executed:
Repository: edgcpp/compiler
Length of output: 1280
Script executed:
Repository: edgcpp/compiler
Length of output: 6263
Handle early exception-specification requests for expansion-only classes.
A potentially evaluated reference to a static member before class fixup can request its exception specification while
exception_spec_arg_cacheis empty. The request discards the cached operand and can abort compilation in a checking build. For example,static_assert(&f != nullptr)can reference a previously declared static memberf.Use the class fixup cache for early requests without disrupting element replay.