https://gcc.gnu.org/g:0ec5cb9985d8f62e5eda909aef715b423d1a4c7e

commit r15-8428-g0ec5cb9985d8f62e5eda909aef715b423d1a4c7e
Author: Owen Avery <powerboat9.ga...@gmail.com>
Date:   Wed Oct 9 21:47:02 2024 -0400

    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 <powerboat9.ga...@gmail.com>

Diff:
---
 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 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 &param)
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

Reply via email to