diff options
author | antego <antego@users.noreply.github.com> | 2022-04-13 20:00:54 +1000 |
---|---|---|
committer | antego <antego@users.noreply.github.com> | 2022-04-23 10:59:44 +1000 |
commit | e26b95f64a0f450199b3a5f58db68dfd0fb585b5 (patch) | |
tree | d29b0a7faa9a1514b6904fbfa65be90e50305857 /gcc/rust | |
parent | 1286acc34e826039ebc8f09ad36dddc30f726283 (diff) | |
download | gcc-e26b95f64a0f450199b3a5f58db68dfd0fb585b5.zip gcc-e26b95f64a0f450199b3a5f58db68dfd0fb585b5.tar.gz gcc-e26b95f64a0f450199b3a5f58db68dfd0fb585b5.tar.bz2 |
Following up on #1141. Implementing macro expansion or ComparisonExpr, LazyBooleanExpr, AssignmentExpr.
Diffstat (limited to 'gcc/rust')
-rw-r--r-- | gcc/rust/expand/rust-attribute-visitor.cc | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/gcc/rust/expand/rust-attribute-visitor.cc b/gcc/rust/expand/rust-attribute-visitor.cc index 859ae7e..e420d09 100644 --- a/gcc/rust/expand/rust-attribute-visitor.cc +++ b/gcc/rust/expand/rust-attribute-visitor.cc @@ -643,10 +643,19 @@ AttrVisitor::visit (AST::ComparisonExpr &expr) /* should have no possibility for outer attrs as would be parsed * with outer expr */ - expr.get_left_expr ()->accept_vis (*this); + auto &l_expr = expr.get_left_expr (); + l_expr->accept_vis (*this); + auto l_fragment = expander.take_expanded_fragment (*this); + if (l_fragment.should_expand ()) + l_expr = l_fragment.take_expression_fragment (); + /* should syntactically not have outer attributes, though this may * not have worked in practice */ - expr.get_right_expr ()->accept_vis (*this); + auto &r_expr = expr.get_right_expr (); + r_expr->accept_vis (*this); + auto r_fragment = expander.take_expanded_fragment (*this); + if (r_fragment.should_expand ()) + r_expr = r_fragment.take_expression_fragment (); // ensure that they are not marked for strip if (expr.get_left_expr ()->is_marked_for_strip ()) @@ -667,10 +676,19 @@ AttrVisitor::visit (AST::LazyBooleanExpr &expr) /* should have no possibility for outer attrs as would be parsed * with outer expr */ - expr.get_left_expr ()->accept_vis (*this); + auto &l_expr = expr.get_left_expr (); + l_expr->accept_vis (*this); + auto l_fragment = expander.take_expanded_fragment (*this); + if (l_fragment.should_expand ()) + l_expr = l_fragment.take_expression_fragment (); + /* should syntactically not have outer attributes, though this may * not have worked in practice */ - expr.get_right_expr ()->accept_vis (*this); + auto &r_expr = expr.get_right_expr (); + r_expr->accept_vis (*this); + auto r_fragment = expander.take_expanded_fragment (*this); + if (r_fragment.should_expand ()) + r_expr = r_fragment.take_expression_fragment (); // ensure that they are not marked for strip if (expr.get_left_expr ()->is_marked_for_strip ()) @@ -718,10 +736,19 @@ AttrVisitor::visit (AST::AssignmentExpr &expr) /* should have no possibility for outer attrs as would be parsed * with outer expr */ - expr.get_left_expr ()->accept_vis (*this); + auto &l_expr = expr.get_left_expr (); + l_expr->accept_vis (*this); + auto l_fragment = expander.take_expanded_fragment (*this); + if (l_fragment.should_expand ()) + l_expr = l_fragment.take_expression_fragment (); + /* should syntactically not have outer attributes, though this may * not have worked in practice */ - expr.get_right_expr ()->accept_vis (*this); + auto &r_expr = expr.get_right_expr (); + r_expr->accept_vis (*this); + auto r_fragment = expander.take_expanded_fragment (*this); + if (r_fragment.should_expand ()) + r_expr = r_fragment.take_expression_fragment (); // ensure that they are not marked for strip if (expr.get_left_expr ()->is_marked_for_strip ()) |