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 authored and P-E-P committed Oct 15, 2024
1 parent 71d2084 commit ab15db3
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: {
visit (operand.get_in ().expr);
break;
}
case RegisterType::Out: {
visit (operand.get_out ().expr);
break;
}
case RegisterType::InOut: {
visit (operand.get_in_out ().expr);
break;
}
case RegisterType::SplitInOut: {
auto split = operand.get_split_in_out ();
visit (split.in_expr);
visit (split.out_expr);
break;
}
case RegisterType::Const: {
visit (operand.get_const ().anon_const.expr);
break;
}
case RegisterType::Sym: {
visit (operand.get_sym ().expr);
break;
}
case RegisterType::Label: {
visit (operand.get_label ().expr);
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 @@ -233,7 +233,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 ab15db3

Please sign in to comment.