LCOV - code coverage report
Current view: top level - gcc/rust/hir/tree - rust-hir-generic-param.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 46.5 % 43 20
Test Date: 2025-06-21 16:26:05 Functions: 50.0 % 8 4
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : // Copyright (C) 2020-2024 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                 :             : #include "rust-hir-generic-param.h"
      20                 :             : 
      21                 :             : namespace Rust {
      22                 :             : namespace HIR {
      23                 :             : 
      24                 :        9280 : GenericParam::GenericParam (Analysis::NodeMapping mapping,
      25                 :        9280 :                             enum GenericKind kind)
      26                 :        9280 :   : mappings (mapping), kind (kind)
      27                 :        9280 : {}
      28                 :             : 
      29                 :         295 : LifetimeParam::LifetimeParam (Analysis::NodeMapping mappings, Lifetime lifetime,
      30                 :             :                               location_t locus,
      31                 :             :                               std::vector<Lifetime> lifetime_bounds,
      32                 :         295 :                               AST::AttrVec outer_attrs)
      33                 :             :   : GenericParam (mappings, GenericKind::LIFETIME),
      34                 :         295 :     lifetime (std::move (lifetime)),
      35                 :         295 :     lifetime_bounds (std::move (lifetime_bounds)),
      36                 :         295 :     outer_attrs (std::move (outer_attrs)), locus (locus)
      37                 :         295 : {}
      38                 :             : 
      39                 :        1687 : LifetimeParam::LifetimeParam (LifetimeParam const &other)
      40                 :             :   : GenericParam (other.mappings, GenericKind::LIFETIME),
      41                 :        1687 :     lifetime (other.lifetime), lifetime_bounds (other.lifetime_bounds),
      42                 :        3374 :     outer_attrs (other.outer_attrs), locus (other.locus)
      43                 :        1687 : {}
      44                 :             : 
      45                 :             : LifetimeParam &
      46                 :           0 : LifetimeParam::operator= (LifetimeParam const &other)
      47                 :             : {
      48                 :           0 :   lifetime = other.lifetime;
      49                 :           0 :   lifetime_bounds = other.lifetime_bounds;
      50                 :           0 :   outer_attrs = other.outer_attrs;
      51                 :           0 :   locus = other.locus;
      52                 :           0 :   mappings = other.mappings;
      53                 :             : 
      54                 :           0 :   return *this;
      55                 :             : }
      56                 :             : 
      57                 :          34 : ConstGenericParam::ConstGenericParam (std::string name,
      58                 :             :                                       std::unique_ptr<Type> type,
      59                 :             :                                       std::unique_ptr<Expr> default_expression,
      60                 :             :                                       Analysis::NodeMapping mapping,
      61                 :          34 :                                       location_t locus)
      62                 :          34 :   : GenericParam (mapping, GenericKind::CONST), name (std::move (name)),
      63                 :          34 :     type (std::move (type)),
      64                 :          34 :     default_expression (std::move (default_expression)), locus (locus)
      65                 :          34 : {}
      66                 :             : 
      67                 :           0 : ConstGenericParam::ConstGenericParam (const ConstGenericParam &other)
      68                 :           0 :   : GenericParam (other)
      69                 :             : {
      70                 :           0 :   name = other.name;
      71                 :           0 :   locus = other.locus;
      72                 :             : 
      73                 :           0 :   if (other.type)
      74                 :           0 :     type = other.type->clone_type ();
      75                 :           0 :   if (other.default_expression)
      76                 :           0 :     default_expression = other.default_expression->clone_expr ();
      77                 :           0 : }
      78                 :             : 
      79                 :             : std::string
      80                 :           0 : ConstGenericParam::as_string () const
      81                 :             : {
      82                 :           0 :   auto result = "ConstGenericParam: " + name + " : " + type->as_string ();
      83                 :             : 
      84                 :           0 :   if (default_expression)
      85                 :           0 :     result += " = " + default_expression->as_string ();
      86                 :             : 
      87                 :           0 :   return result;
      88                 :             : }
      89                 :             : 
      90                 :             : void
      91                 :           0 : ConstGenericParam::accept_vis (HIRFullVisitor &)
      92                 :           0 : {}
      93                 :             : 
      94                 :             : } // namespace HIR
      95                 :             : } // namespace Rust
        

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.