LCOV - code coverage report
Current view: top level - gcc/rust/ast - rust-desugar-while-let.h Coverage Total Hit
Test: gcc.info Lines: 100.0 % 1 1
Test Date: 2026-02-28 14:20:25 Functions: - 0 0
Legend: Lines:     hit not hit

            Line data    Source code
       1              : // Copyright (C) 2025-2026 Free Software Foundation, Inc.
       2              : 
       3              : // This file is part of GCC.
       4              : 
       5              : // GCC is free software; you can redistribute it and/or modify it under
       6              : // the terms of the GNU General Public License as published by the Free
       7              : // Software Foundation; either version 3, or (at your option) any later
       8              : // version.
       9              : 
      10              : // GCC is distributed in the hope that it will be useful, but WITHOUT ANY
      11              : // WARRANTY; without even the implied warranty of MERCHANTABILITY or
      12              : // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      13              : // for more details.
      14              : 
      15              : // You should have received a copy of the GNU General Public License
      16              : // along with GCC; see the file COPYING3.  If not see
      17              : // <http://www.gnu.org/licenses/>.
      18              : 
      19              : #ifndef RUST_DESUGAR_WHILE_LET_H
      20              : #define RUST_DESUGAR_WHILE_LET_H
      21              : 
      22              : #include "rust-ast-builder.h"
      23              : #include "rust-expr.h"
      24              : 
      25              : namespace Rust {
      26              : namespace AST {
      27              : 
      28              : // Desugar while-let into a set of other AST nodes. The desugar is of the
      29              : // following form:
      30              : //
      31              : // ```
      32              : // whilet let <pat> = <expr> <body>
      33              : // ```
      34              : //
      35              : // becomes:
      36              : //
      37              : // ```
      38              : // loop {
      39              : //     match <expr> {
      40              : //         <pat> => <body>,
      41              : //         _ => break
      42              : //     }
      43              : // }
      44              : // ```
      45              : class DesugarWhileLet
      46              : {
      47              : public:
      48              :   static void go (std::unique_ptr<Expr> &ptr);
      49              : 
      50              : private:
      51              :   DesugarWhileLet ();
      52              : 
      53              :   struct DesugarCtx
      54              :   {
      55            2 :     DesugarCtx (location_t loc) : builder (Builder (loc)), loc (loc) {}
      56              : 
      57              :     Builder builder;
      58              :     location_t loc;
      59              : 
      60              :     MatchCase make_break_arm ();
      61              :     MatchCase make_continue_arm (std::unique_ptr<Pattern> &&pattern,
      62              :                                  std::unique_ptr<BlockExpr> &&body);
      63              :   };
      64              : 
      65              :   std::unique_ptr<Expr> desugar (WhileLetLoopExpr &expr);
      66              : };
      67              : 
      68              : } // namespace AST
      69              : } // namespace Rust
      70              : 
      71              : #endif // ! RUST_DESUGAR_WHILE_LET_H
        

Generated by: LCOV version 2.4-beta

LCOV profile is generated on x86_64 machine using following configure options: configure --disable-bootstrap --enable-coverage=opt --enable-languages=c,c++,fortran,go,jit,lto,rust,m2 --enable-host-shared. GCC test suite is run with the built compiler.