aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/resolve
diff options
context:
space:
mode:
authorMatthew Jasper <mjjasper1@gmail.com>2023-06-08 20:30:06 +0100
committerPhilip Herron <philip.herron@embecosm.com>2023-06-20 08:10:23 +0000
commitdbf982cbd898adc581a28934f701acd6db27d5f8 (patch)
treede7e6e73729b1ed0d7e31763993cfde26fc7ca93 /gcc/rust/resolve
parent33544f79849a5b747d84fea0fc2be25e208e3ab4 (diff)
downloadgcc-dbf982cbd898adc581a28934f701acd6db27d5f8.zip
gcc-dbf982cbd898adc581a28934f701acd6db27d5f8.tar.gz
gcc-dbf982cbd898adc581a28934f701acd6db27d5f8.tar.bz2
gccrs: Parse statement macros as statements.
gcc/rust/ChangeLog: * ast/rust-ast.h (Expr::to_stmt): Remove method. * ast/rust-macro.h (MacroInvocation::to_stmt): Remove override. * ast/rust-stmt.h: Remove use of Expr::to_stmt. * expand/rust-macro-expand.h (struct MacroExpander): Add EXPR/STMT and remove BLOCK from ContextType. * expand/rust-expand-visitor.cc (ExpandVisitor::maybe_expand_expr): Use EXPR context. (ExpandVisitor::expand_inner_stmts): Use STMT context. (ExpandVisitor::visitor): Remove use of BLOCK context. * expand/rust-macro-expand.cc (transcribe_on_delimiter): Remove function. (transcribe_context): Use EXPR/STMT contexts. (MacroExpander::parse_proc_macro_output): Use EXPR/STMT contexts. * parse/rust-parse-impl.h (Parser::parse_stmt): Delegate macro parsing to parse_expr_stmt, check for ! after macro_rules. (Parser::parse_expr_stmt): Parse macro statements/expression statements starting with a macro. (Parser::parse_match_expr): Don't modify flag unnecessarily. (Parser::parse_stmt_or_expr): Parse macro statements/expression statements starting with a macro. (Parser::parse_path_based_stmt_or_expr): Remove method. (Parser::parse_macro_invocation_maybe_semi): Remove method. (Parser::parse_expr): Move code into left_denotations. (Parser::left_denotations): New method. (Parser::null_denotation): Split out methods for cases with and without paths. (Parser::null_denotation_path): New method. (Parser::null_denotation_not_path): New method. (Parser::parse_macro_invocation_partial): Don't check for semicolon here. * parse/rust-parse.h: Update declarations. gcc/testsuite/ChangeLog: * rust/compile/braced_macro_arm.rs: New test. * rust/compile/braced_macro_statements1.rs: New test. * rust/compile/braced_macro_statements2.rs: New test. * rust/compile/braced_macro_statements3.rs: New test. * rust/compile/issue-2225.rs: Update test. Signed-off-by: Matthew Jasper <mjjasper1@gmail.com>
Diffstat (limited to 'gcc/rust/resolve')
0 files changed, 0 insertions, 0 deletions