LCOV - code coverage report
Current view: top level - gcc/rust/hir/tree - rust-hir-pattern-abstract.h (source / functions) Coverage Total Hit
Test: gcc.info Lines: 50.0 % 6 3
Test Date: 2026-02-28 14:20:25 Functions: 0.0 % 2 0
Legend: Lines:     hit not hit

            Line data    Source code
       1              : // Copyright (C) 2020-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_HIR_PATTERN_ABSTRACT_H
      20              : #define RUST_HIR_PATTERN_ABSTRACT_H
      21              : 
      22              : #include "rust-hir-visitable.h"
      23              : #include "rust-hir-visitor.h"
      24              : #include "rust-hir-node.h"
      25              : #include "rust-system.h"
      26              : 
      27              : namespace Rust {
      28              : namespace HIR {
      29              : 
      30              : // Pattern base HIR node
      31       137407 : class Pattern : public Node, virtual public FullVisitable
      32              : {
      33              : public:
      34              :   using FullVisitable::accept_vis;
      35              : 
      36              :   enum PatternType
      37              :   {
      38              :     PATH,
      39              :     LITERAL,
      40              :     IDENTIFIER,
      41              :     WILDCARD,
      42              :     RANGE,
      43              :     REFERENCE,
      44              :     STRUCT,
      45              :     TUPLE_STRUCT,
      46              :     TUPLE,
      47              :     GROUPED,
      48              :     SLICE,
      49              :     ALT
      50              :   };
      51              : 
      52            0 :   BaseKind get_hir_kind () override final { return PATTERN; }
      53              : 
      54              :   // Unique pointer custom clone function
      55        54827 :   std::unique_ptr<Pattern> clone_pattern () const
      56              :   {
      57        54827 :     return std::unique_ptr<Pattern> (clone_pattern_impl ());
      58              :   }
      59              : 
      60              :   // possible virtual methods: is_refutable()
      61              : 
      62              :   virtual ~Pattern () {}
      63              : 
      64              :   virtual std::string to_string () const = 0;
      65              : 
      66            0 :   std::string to_debug_string () const
      67              :   {
      68            0 :     return to_string () + get_mappings ().as_string ();
      69              :   }
      70              : 
      71              :   virtual void accept_vis (HIRPatternVisitor &vis) = 0;
      72              : 
      73              :   virtual const Analysis::NodeMapping &get_mappings () const = 0;
      74              : 
      75              :   virtual location_t get_locus () const = 0;
      76              : 
      77              :   virtual PatternType get_pattern_type () const = 0;
      78              : 
      79              : protected:
      80              :   // Clone pattern implementation as pure virtual method
      81              :   virtual Pattern *clone_pattern_impl () const = 0;
      82              : };
      83              : 
      84              : } // namespace HIR
      85              : } // namespace Rust
      86              : 
      87              : #endif
        

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.