Skip to content

Commit

Permalink
Improve handling of InlineAsm in DefaultASTVisitor
Browse files Browse the repository at this point in the history
gcc/rust/ChangeLog:

	* ast/rust-ast-visitor.cc
	(DefaultASTVisitor::visit): Visit fields of InlineAsm.

gcc/testsuite/ChangeLog:

	* rust/compile/nr2/exclude: Remove
	inline_asm_parse_output_operand.rs.

Signed-off-by: Owen Avery <[email protected]>
  • Loading branch information
powerboat9 committed Oct 10, 2024
1 parent 1499466 commit 952b05e
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
41 changes: 40 additions & 1 deletion gcc/rust/ast/rust-ast-visitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,46 @@ DefaultASTVisitor::visit (AST::AsyncBlockExpr &expr)

void
DefaultASTVisitor::visit (AST::InlineAsm &expr)
{}
{
visit_outer_attrs (expr);
using RegisterType = AST::InlineAsmOperand::RegisterType;
for (auto &operand : expr.get_operands ())
{
switch (operand.get_register_type ())
{
case RegisterType::In: {
operand.get_in ().expr->accept_vis (*this);
break;
}
case RegisterType::Out: {
operand.get_out ().expr->accept_vis (*this);
break;
}
case RegisterType::InOut: {
operand.get_in_out ().expr->accept_vis (*this);
break;
}
case RegisterType::SplitInOut: {
auto split = operand.get_split_in_out ();
split.in_expr->accept_vis (*this);
split.out_expr->accept_vis (*this);
break;
}
case RegisterType::Const: {
operand.get_const ().anon_const.expr->accept_vis (*this);
break;
}
case RegisterType::Sym: {
operand.get_sym ().expr->accept_vis (*this);
break;
}
case RegisterType::Label: {
operand.get_label ().expr->accept_vis (*this);
break;
}
}
}
}

void
DefaultASTVisitor::visit (AST::TypeParam &param)
Expand Down
1 change: 0 additions & 1 deletion gcc/testsuite/rust/compile/nr2/exclude
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ issue-3045-1.rs
issue-3045-2.rs
issue-3046.rs
unknown-associated-item.rs
inline_asm_parse_output_operand.rs
issue-3030.rs
issue-3035.rs
issue-3082.rs
Expand Down

0 comments on commit 952b05e

Please sign in to comment.