aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/ast/rust-macro.h
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2022-03-14 17:08:07 +0100
committerArthur Cohen <arthur.cohen@embecosm.com>2022-03-17 15:51:06 +0100
commit1a2ef9cae90db5bdb18723b6adafe2750a95ed76 (patch)
treec634ec46956c01a631ba528854975b45b82739a7 /gcc/rust/ast/rust-macro.h
parent1a14348afefc62313e38156fde768744378f9ebf (diff)
downloadgcc-1a2ef9cae90db5bdb18723b6adafe2750a95ed76.zip
gcc-1a2ef9cae90db5bdb18723b6adafe2750a95ed76.tar.gz
gcc-1a2ef9cae90db5bdb18723b6adafe2750a95ed76.tar.bz2
macros: Add remaining context and improve parsing macro dispatch
This allows us to expand macor invocations in more places, as macro calls are not limited to statements or expressions. It is quite common to use macros to abstract writing repetitive boilerplate for type implementations, for example.
Diffstat (limited to 'gcc/rust/ast/rust-macro.h')
-rw-r--r--gcc/rust/ast/rust-macro.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/rust/ast/rust-macro.h b/gcc/rust/ast/rust-macro.h
index 1c5d102..5ecd5d7 100644
--- a/gcc/rust/ast/rust-macro.h
+++ b/gcc/rust/ast/rust-macro.h
@@ -460,6 +460,7 @@ class MacroInvocation : public TypeNoBounds,
public TraitItem,
public TraitImplItem,
public InherentImplItem,
+ public ExternalItem,
public ExprWithoutBlock
{
std::vector<Attribute> outer_attrs;
@@ -537,6 +538,11 @@ protected:
return clone_macro_invocation_impl ();
}
+ MacroInvocation *clone_external_item_impl () const final override
+ {
+ return clone_macro_invocation_impl ();
+ }
+
/*virtual*/ MacroInvocation *clone_macro_invocation_impl () const
{
return new MacroInvocation (*this);