aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/expand/rust-macro-expand.h
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2023-03-20 03:10:26 +0100
committerCohenArthur <arthur.cohen@embecosm.com>2023-03-25 08:47:56 +0000
commite10e882ddf3d0f85f36e6645c4637f9725ee2562 (patch)
treead265ba4af46d53e1fbdeccbbbcde5cfeab3e0c3 /gcc/rust/expand/rust-macro-expand.h
parent2b52571e8aa28a100b8989ece12e929a9fb6bcf4 (diff)
downloadgcc-e10e882ddf3d0f85f36e6645c4637f9725ee2562.zip
gcc-e10e882ddf3d0f85f36e6645c4637f9725ee2562.tar.gz
gcc-e10e882ddf3d0f85f36e6645c4637f9725ee2562.tar.bz2
expand: Move cfg-attrs related functions out of MacroExpander
The current situation where the MacroExpander and AttrVisitor recursively call into each other is not great, and causes pains for macro imports. We need to split this pass in two, with one pass being responsible for cfg-attr checking and stripping, and one being responsible for macro expansion. gcc/rust/ChangeLog: * expand/rust-macro-expand.cc (MacroExpander::expand_crate): Do not cfg-attr strip in MacroExpander (MacroExpander::fails_cfg): Function moved... (MacroExpander::fails_cfg_with_expand): Function moved... (MacroExpander::expand_cfg_attrs): Function moved... * expand/rust-attribute-visitor.cc (fails_cfg): ...here. (fails_cfg_with_expand): ...here. (expand_cfg_attrs): ...here. (AttrVisitor::expand_struct_fields): Use new functions. (AttrVisitor::expand_tuple_fields): Likewise. (AttrVisitor::expand_function_params): Likewise. (AttrVisitor::visit): Likewise. (AttrVisitor::go): New function. * expand/rust-attribute-visitor.h: Declare AttrVisitor::go. * expand/rust-macro-expand.h (struct MacroExpander): Remove cfg-attr related functions.
Diffstat (limited to 'gcc/rust/expand/rust-macro-expand.h')
-rw-r--r--gcc/rust/expand/rust-macro-expand.h4
1 files changed, 0 insertions, 4 deletions
diff --git a/gcc/rust/expand/rust-macro-expand.h b/gcc/rust/expand/rust-macro-expand.h
index 9471416..aea761b 100644
--- a/gcc/rust/expand/rust-macro-expand.h
+++ b/gcc/rust/expand/rust-macro-expand.h
@@ -256,10 +256,6 @@ struct MacroExpander
AST::MacroRulesDefinition &rules_def,
bool semicolon);
- void expand_cfg_attrs (AST::AttrVec &attrs);
- bool fails_cfg (const AST::AttrVec &attr) const;
- bool fails_cfg_with_expand (AST::AttrVec &attrs) const;
-
bool depth_exceeds_recursion_limit () const;
bool try_match_rule (AST::MacroRule &match_rule,