]> git.ipfire.org Git - thirdparty/gcc.git/commit
gccrs: expand: Move derive system to new one
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Fri, 2 Jun 2023 09:41:53 +0000 (11:41 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:46:26 +0000 (18:46 +0100)
commitf1afcf9fd5e85722766a803dac6c9e6bd90161cc
tree95dd933fdd287968b88406b90230504ae39f821a
parent4ac118445077fca5153730740d7233b055821746
gccrs: expand: Move derive system to new one

Builtin derive already had their own code scheme, incompatible with the
proc macro pattern. This commit unifies derive macros with it.

gcc/rust/ChangeLog:

* ast/rust-ast-fragment.cc (Fragment::Fragment): Remove
overwrite member in constructor.
(Fragment::operator=): Removal of overwrite member in copy.
(Fragment::should_overwrite): Remove overwrite getter.
* ast/rust-ast-fragment.h: Remove overwrite boolean member.
* expand/rust-expand-visitor.cc (derive_item): Add a function to
derive items using the expander for now.
(builtin_derive_item): Rename from derive_item to
builtin_derive_item.
(ExpandVisitor::visit): Remove visit to derive attributes.
(ExpandVisitor::expand_derive): Remove derive attribute visitor.
(ExpandVisitor::visit_attrs_with_derive): Likewise.
* expand/rust-expand-visitor.h: Update insertion of other kind
of proc macros. We no longer have an overwrite attribute in the
fragment.
* expand/rust-macro-expand.cc (MacroExpander::parse_procmacro_output):
Return the fragment instead of inserting it.
* expand/rust-macro-expand.h (struct MacroExpander): Return
fragment.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/ast/rust-ast-fragment.cc
gcc/rust/ast/rust-ast-fragment.h
gcc/rust/expand/rust-expand-visitor.cc
gcc/rust/expand/rust-expand-visitor.h
gcc/rust/expand/rust-macro-expand.cc
gcc/rust/expand/rust-macro-expand.h