public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] Merge #938
@ 2022-06-08 12:08 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-06-08 12:08 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:9fb06d66cef70584e7aa2fa3a6ad22ef7def6b84

commit 9fb06d66cef70584e7aa2fa3a6ad22ef7def6b84
Merge: 752bf6c80a9 37415eec774
Author: bors[bot] <26634292+bors[bot]@users.noreply.github.com>
Date:   Thu Feb 17 17:02:43 2022 +0000

    Merge #938
    
    938: First pass at declarative macro expansion  r=philberty a=philberty
    
    This does not support repetition matchers but it supports simple
    declarative macros and transcribes them. The approach taken here is that
    we reuse our existing parser to call the apropriate functions as specified
    as part of the MacroFragmentType enum if the parser does not have errors
    parsing that item then it must be a match.
    
    Then once we match a rule we have a map of the token begin/end offsets
    for each fragment match, this is then used to adjust and create a new token
    stream for the macro rule definition so that when we feed it to the parser
    the tokens are already substituted. The resulting expression or item is
    then attached to the respective macro invocation and this is then name
    resolved and used for hir lowering.
    
    Fixes #17 #22
    Addresses #573
    
    Co-authored-by: Philip Herron <philip.herron@embecosm.com>

Diff:

 gcc/rust/ast/rust-ast-full-test.cc            |  13 -
 gcc/rust/ast/rust-ast.h                       | 224 +++++++--
 gcc/rust/ast/rust-macro.h                     | 100 ++--
 gcc/rust/expand/rust-macro-expand.cc          | 632 ++++++++++++++++++++++++--
 gcc/rust/expand/rust-macro-expand.h           | 148 +++++-
 gcc/rust/hir/rust-ast-lower-expr.h            |  10 +
 gcc/rust/hir/rust-ast-lower-implitem.h        |  20 +
 gcc/rust/hir/rust-ast-lower-item.h            |  10 +
 gcc/rust/hir/rust-ast-lower-stmt.h            |  10 +
 gcc/rust/lex/rust-lex.h                       |  19 +
 gcc/rust/parse/rust-parse-impl.h              |  26 ++
 gcc/rust/parse/rust-parse.cc                  |  26 --
 gcc/rust/parse/rust-parse.h                   |  46 +-
 gcc/rust/resolve/rust-ast-resolve-expr.h      |   7 +
 gcc/rust/resolve/rust-ast-resolve-implitem.h  |  21 +
 gcc/rust/resolve/rust-ast-resolve-item.h      |  14 +
 gcc/rust/resolve/rust-ast-resolve-stmt.h      |   8 +
 gcc/rust/resolve/rust-ast-resolve-toplevel.h  |   7 +
 gcc/rust/resolve/rust-ast-resolve.cc          |  40 ++
 gcc/rust/resolve/rust-name-resolver.h         |   9 +
 gcc/rust/typecheck/rust-tycheck-dump.h        |   6 +
 gcc/rust/util/rust-hir-map.cc                 |  20 +
 gcc/rust/util/rust-hir-map.h                  |   7 +
 gcc/testsuite/rust/execute/torture/macros1.rs |  13 +
 gcc/testsuite/rust/execute/torture/macros2.rs |  40 ++
 gcc/testsuite/rust/execute/torture/macros3.rs |  61 +++
 gcc/testsuite/rust/execute/torture/macros4.rs |  15 +
 gcc/testsuite/rust/execute/torture/macros5.rs |  13 +
 gcc/testsuite/rust/execute/torture/macros6.rs |  12 +
 gcc/testsuite/rust/execute/xfail/macro2.rs    |  30 --
 gcc/testsuite/rust/execute/xfail/macro3.rs    |  45 --
 31 files changed, 1383 insertions(+), 269 deletions(-)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-08 12:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 12:08 [gcc/devel/rust/master] Merge #938 Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).