diff options
Diffstat (limited to 'gcc/rust/expand/rust-macro-expand.cc')
-rw-r--r-- | gcc/rust/expand/rust-macro-expand.cc | 69 |
1 files changed, 13 insertions, 56 deletions
diff --git a/gcc/rust/expand/rust-macro-expand.cc b/gcc/rust/expand/rust-macro-expand.cc index 39bba4f..2f4c010 100644 --- a/gcc/rust/expand/rust-macro-expand.cc +++ b/gcc/rust/expand/rust-macro-expand.cc @@ -1529,13 +1529,12 @@ public: } void visit (AST::IfExpr &expr) override { - // initial strip test based on outer attrs - expander.expand_cfg_attrs (expr.get_outer_attrs ()); - if (expander.fails_cfg_with_expand (expr.get_outer_attrs ())) - { - expr.mark_for_strip (); - return; - } + // TODO: for if expressions, are attributes allowed if it is part of an expression statement? + // if so, probably have to add a "does_expr_allow_attrs()" method to Expr and then don't move attrs. + // otherwise, that may be useful anyway for better error messages. + + // NOTE: IfExpr literally doesn't support outer attrs, so no strip code + // TODO: is this still true? can't find info on page // can't strip condition expr itself, but can strip sub-expressions auto &condition_expr = expr.get_condition_expr (); @@ -1555,13 +1554,7 @@ public: } void visit (AST::IfExprConseqElse &expr) override { - // initial strip test based on outer attrs - expander.expand_cfg_attrs (expr.get_outer_attrs ()); - if (expander.fails_cfg_with_expand (expr.get_outer_attrs ())) - { - expr.mark_for_strip (); - return; - } + // NOTE: IfExpr literally doesn't support outer attrs, so no strip code // can't strip condition expr itself, but can strip sub-expressions auto &condition_expr = expr.get_condition_expr (); @@ -1589,13 +1582,7 @@ public: } void visit (AST::IfExprConseqIf &expr) override { - // initial strip test based on outer attrs - expander.expand_cfg_attrs (expr.get_outer_attrs ()); - if (expander.fails_cfg_with_expand (expr.get_outer_attrs ())) - { - expr.mark_for_strip (); - return; - } + // NOTE: IfExpr literally doesn't support outer attrs, so no strip code // can't strip condition expr itself, but can strip sub-expressions auto &condition_expr = expr.get_condition_expr (); @@ -1623,13 +1610,7 @@ public: } void visit (AST::IfExprConseqIfLet &expr) override { - // initial strip test based on outer attrs - expander.expand_cfg_attrs (expr.get_outer_attrs ()); - if (expander.fails_cfg_with_expand (expr.get_outer_attrs ())) - { - expr.mark_for_strip (); - return; - } + // NOTE: IfExpr literally doesn't support outer attrs, so no strip code // can't strip condition expr itself, but can strip sub-expressions auto &condition_expr = expr.get_condition_expr (); @@ -1658,13 +1639,7 @@ public: } void visit (AST::IfLetExpr &expr) override { - // initial strip test based on outer attrs - expander.expand_cfg_attrs (expr.get_outer_attrs ()); - if (expander.fails_cfg_with_expand (expr.get_outer_attrs ())) - { - expr.mark_for_strip (); - return; - } + // NOTE: IfLetExpr literally doesn't support outer attrs, so no strip code for (auto &pattern : expr.get_patterns ()) { @@ -1692,13 +1667,7 @@ public: } void visit (AST::IfLetExprConseqElse &expr) override { - // initial strip test based on outer attrs - expander.expand_cfg_attrs (expr.get_outer_attrs ()); - if (expander.fails_cfg_with_expand (expr.get_outer_attrs ())) - { - expr.mark_for_strip (); - return; - } + // NOTE: IfLetExpr literally doesn't support outer attrs, so no strip code for (auto &pattern : expr.get_patterns ()) { @@ -1734,13 +1703,7 @@ public: } void visit (AST::IfLetExprConseqIf &expr) override { - // initial strip test based on outer attrs - expander.expand_cfg_attrs (expr.get_outer_attrs ()); - if (expander.fails_cfg_with_expand (expr.get_outer_attrs ())) - { - expr.mark_for_strip (); - return; - } + // NOTE: IfLetExpr literally doesn't support outer attrs, so no strip code for (auto &pattern : expr.get_patterns ()) { @@ -1776,13 +1739,7 @@ public: } void visit (AST::IfLetExprConseqIfLet &expr) override { - // initial strip test based on outer attrs - expander.expand_cfg_attrs (expr.get_outer_attrs ()); - if (expander.fails_cfg_with_expand (expr.get_outer_attrs ())) - { - expr.mark_for_strip (); - return; - } + // NOTE: IfLetExpr literally doesn't support outer attrs, so no strip code for (auto &pattern : expr.get_patterns ()) { |