From: Pierre-Emmanuel Patry Date: Tue, 1 Apr 2025 14:10:38 +0000 (+0200) Subject: gccrs: Update ast visitor with proper check for looplabel X-Git-Tag: basepoints/gcc-16~258 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3cf4d5cb996a062a22fe6fb496a622ec7519bd65;p=thirdparty%2Fgcc.git gccrs: Update ast visitor with proper check for looplabel The visitor was visiting loop label even when they did not exist. gcc/rust/ChangeLog: * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Add check for loop label before visiting it. Signed-off-by: Pierre-Emmanuel Patry --- diff --git a/gcc/rust/ast/rust-ast-visitor.cc b/gcc/rust/ast/rust-ast-visitor.cc index 73c6b1ee31e..38617bf4a99 100644 --- a/gcc/rust/ast/rust-ast-visitor.cc +++ b/gcc/rust/ast/rust-ast-visitor.cc @@ -559,7 +559,8 @@ void DefaultASTVisitor::visit (AST::LoopExpr &expr) { visit_outer_attrs (expr); - visit (expr.get_loop_label ()); + if (expr.has_loop_label ()) + visit (expr.get_loop_label ()); visit (expr.get_loop_block ()); }