From: Owen Avery Date: Thu, 10 Oct 2024 01:47:02 +0000 (-0400) Subject: gccrs: Improve handling of InlineAsm in DefaultASTVisitor X-Git-Tag: basepoints/gcc-16~1125 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0ec5cb9985d8f62e5eda909aef715b423d1a4c7e;p=thirdparty%2Fgcc.git gccrs: 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 --- diff --git a/gcc/rust/ast/rust-ast-visitor.cc b/gcc/rust/ast/rust-ast-visitor.cc index b124531b09c3..8f53e528131a 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