LCOV - code coverage report
Current view: top level - gcc/rust/checks/errors/borrowck - rust-bir-builder-pattern.h (source / functions) Coverage Total Hit
Test: gcc.info Lines: 0.0 % 13 0
Test Date: 2025-06-21 16:26:05 Functions: 0.0 % 6 0
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : // Copyright (C) 2020-2025 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_BIR_BUILDER_PATTERN_H
      20                 :             : #define RUST_BIR_BUILDER_PATTERN_H
      21                 :             : 
      22                 :             : #include "rust-bir-builder-internal.h"
      23                 :             : #include "rust-bir-free-region.h"
      24                 :             : #include "rust-tyty-variance-analysis.h"
      25                 :             : 
      26                 :             : namespace Rust {
      27                 :             : namespace BIR {
      28                 :             : 
      29                 :             : /**
      30                 :             :  * Compiles binding of values into newly created variables.
      31                 :             :  * Used in let, match arm, and function parameter patterns.
      32                 :             :  */
      33                 :           0 : class PatternBindingBuilder : protected AbstractBuilder,
      34                 :             :                               public HIR::HIRPatternVisitor
      35                 :             : {
      36                 :             :   /** Value of initialization expression. */
      37                 :             :   tl::optional<PlaceId> init;
      38                 :             :   tl::optional<TyTy::BaseType *> type_annotation;
      39                 :             :   tl::optional<FreeRegions> regions;
      40                 :             : 
      41                 :             :   /** Emulates recursive stack saving and restoring inside a visitor. */
      42                 :             :   class SavedState
      43                 :             :   {
      44                 :             :     PatternBindingBuilder *builder;
      45                 :             : 
      46                 :             :   public:
      47                 :             :     const tl::optional<PlaceId> init;
      48                 :             :     const tl::optional<FreeRegions> regions;
      49                 :             : 
      50                 :             :   public:
      51                 :           0 :     explicit SavedState (PatternBindingBuilder *builder)
      52                 :           0 :       : builder (builder), init (builder->init), regions (builder->regions)
      53                 :             :     {}
      54                 :             : 
      55                 :           0 :     ~SavedState () { builder->init = init; }
      56                 :             :   };
      57                 :             : 
      58                 :             : public:
      59                 :           0 :   PatternBindingBuilder (BuilderContext &ctx, tl::optional<PlaceId> init,
      60                 :             :                          tl::optional<TyTy::BaseType *> type_annotation)
      61                 :           0 :     : AbstractBuilder (ctx), init (init), type_annotation (type_annotation),
      62                 :           0 :       regions (tl::nullopt)
      63                 :             :   {}
      64                 :             : 
      65                 :           0 :   void go (HIR::Pattern &pattern) { pattern.accept_vis (*this); }
      66                 :             : 
      67                 :             :   void visit_identifier (const Analysis::NodeMapping &node, bool is_ref,
      68                 :             :                          location_t location, bool is_mut = false);
      69                 :             : 
      70                 :             :   void visit (HIR::IdentifierPattern &pattern) override;
      71                 :             : 
      72                 :             :   void visit (HIR::ReferencePattern &pattern) override;
      73                 :             : 
      74                 :             :   void visit (HIR::SlicePattern &pattern) override;
      75                 :             : 
      76                 :             :   void visit (HIR::AltPattern &pattern) override;
      77                 :             : 
      78                 :             :   void visit (HIR::StructPattern &pattern) override;
      79                 :             : 
      80                 :             :   void visit_tuple_fields (std::vector<std::unique_ptr<HIR::Pattern>> &fields,
      81                 :             :                            SavedState &saved, size_t &index);
      82                 :             : 
      83                 :             :   void visit (HIR::TuplePattern &pattern) override;
      84                 :             : 
      85                 :             :   void visit (HIR::TupleStructPattern &pattern) override;
      86                 :           0 :   void visit (HIR::WildcardPattern &pattern) override {}
      87                 :             : 
      88                 :             :   // Unused for binding.
      89                 :           0 :   void visit (HIR::LiteralPattern &pattern) override {}
      90                 :           0 :   void visit (HIR::PathInExpression &expression) override {}
      91                 :           0 :   void visit (HIR::QualifiedPathInExpression &expression) override {}
      92                 :           0 :   void visit (HIR::RangePattern &pattern) override {}
      93                 :             : };
      94                 :             : 
      95                 :             : } // namespace BIR
      96                 :             : } // namespace Rust
      97                 :             : 
      98                 :             : #endif // RUST_BIR_BUILDER_PATTERN_H
        

Generated by: LCOV version 2.1-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.