]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: ast: Visit block labels if they are present
authorArthur Cohen <arthur.cohen@embecosm.com>
Mon, 21 Jul 2025 08:12:13 +0000 (10:12 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 5 Aug 2025 14:36:57 +0000 (16:36 +0200)
gcc/rust/ChangeLog:

* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Visit a block's loop label if it
exists.

gcc/rust/ast/rust-ast-visitor.cc

index 32d5d32e43fee17870c583406f86438448a94f61..7be2ecc1b48dc3aac5a2508fd863dcf9b0c9a450 100644 (file)
@@ -449,8 +449,13 @@ DefaultASTVisitor::visit (AST::BlockExpr &expr)
 {
   visit_outer_attrs (expr);
   visit_inner_attrs (expr);
+
+  if (expr.has_label ())
+    visit (expr.get_label ());
+
   for (auto &stmt : expr.get_statements ())
     visit (stmt);
+
   if (expr.has_tail_expr ())
     visit (expr.get_tail_expr ());
 }