diff options
author | SimplyTheOther <simplytheother@gmail.com> | 2021-02-02 13:19:26 +0800 |
---|---|---|
committer | SimplyTheOther <simplytheother@gmail.com> | 2021-02-02 15:55:58 +0800 |
commit | 3a0c8ca2156038b726e2689e9b46be4d8c40c55f (patch) | |
tree | 3c5e0391cd9ba3a2336a0692f0bc7980469dc165 /gcc/rust/expand/rust-macro-expand.cc | |
parent | b3a39d99c1d6f45890dbac33a9d17c8dd464654e (diff) | |
download | gcc-3a0c8ca2156038b726e2689e9b46be4d8c40c55f.zip gcc-3a0c8ca2156038b726e2689e9b46be4d8c40c55f.tar.gz gcc-3a0c8ca2156038b726e2689e9b46be4d8c40c55f.tar.bz2 |
Cleanup of AST - moved outer_attrs to child classes
Fixed compile errors
Fixed more compile errors
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 ()) { |