From 035687d5dd0ead4948dc84d0fc472dba57ac6687 Mon Sep 17 00:00:00 2001 From: Owen Avery Date: Wed, 9 Oct 2024 21:47:02 -0400 Subject: [PATCH] Improve handling of InlineAsm in DefaultASTVisitor 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 --- gcc/rust/ast/rust-ast-visitor.cc | 41 +++++++++++++++++++++++++- gcc/testsuite/rust/compile/nr2/exclude | 1 - 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/gcc/rust/ast/rust-ast-visitor.cc b/gcc/rust/ast/rust-ast-visitor.cc index 1aa0918b085e..a57d1a0bdd8a 100644 --- a/gcc/rust/ast/rust-ast-visitor.cc +++ b/gcc/rust/ast/rust-ast-visitor.cc @@ -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 ¶m) diff --git a/gcc/testsuite/rust/compile/nr2/exclude b/gcc/testsuite/rust/compile/nr2/exclude index 166977e7bacc..6c7d50412913 100644 --- a/gcc/testsuite/rust/compile/nr2/exclude +++ b/gcc/testsuite/rust/compile/nr2/exclude @@ -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