LCOV - code coverage report
Current view: top level - gcc/rust/hir/tree - rust-hir-bound.h (source / functions) Coverage Total Hit
Test: gcc.info Lines: 85.7 % 14 12
Test Date: 2026-02-28 14:20:25 Functions: 75.0 % 4 3
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_BOUND_H
      20              : #define RUST_HIR_BOUND_H
      21              : 
      22              : #include "rust-hir-bound-abstract.h"
      23              : #include "rust-common.h"
      24              : #include "rust-hir-path.h"
      25              : 
      26              : namespace Rust {
      27              : namespace HIR {
      28              : 
      29              : // Represents a lifetime (and is also a kind of type param bound)
      30        21602 : class Lifetime : public TypeParamBound
      31              : {
      32              : private:
      33              :   AST::Lifetime::LifetimeType lifetime_type;
      34              :   std::string lifetime_name;
      35              :   location_t locus;
      36              :   Analysis::NodeMapping mappings;
      37              : 
      38              : public:
      39              :   // Constructor
      40         9302 :   Lifetime (Analysis::NodeMapping mapping, AST::Lifetime::LifetimeType type,
      41              :             std::string name, location_t locus)
      42         9509 :     : lifetime_type (type), lifetime_name (std::move (name)), locus (locus),
      43         9302 :       mappings (mapping)
      44              :   {}
      45              : 
      46              :   // Returns true if the lifetime is in an error state.
      47              :   std::string to_string () const override;
      48              : 
      49              :   void accept_vis (HIRFullVisitor &vis) override;
      50              : 
      51         1297 :   WARN_UNUSED_RESULT const std::string &get_name () const
      52              :   {
      53         1298 :     return lifetime_name;
      54              :   }
      55              : 
      56        31222 :   AST::Lifetime::LifetimeType get_lifetime_type () const
      57              :   {
      58        31222 :     return lifetime_type;
      59              :   }
      60              : 
      61           16 :   location_t get_locus () const override final { return locus; }
      62              : 
      63           74 :   Analysis::NodeMapping get_mappings () const override final
      64              :   {
      65           74 :     return mappings;
      66              :   }
      67              : 
      68           11 :   BoundType get_bound_type () const final override { return LIFETIME; }
      69              : 
      70              : protected:
      71              :   /* Use covariance to implement clone function as returning this object rather
      72              :    * than base */
      73            0 :   Lifetime *clone_type_param_bound_impl () const override
      74              :   {
      75            0 :     return new Lifetime (*this);
      76              :   }
      77              : };
      78              : 
      79              : } // namespace HIR
      80              : } // namespace Rust
      81              : 
      82              : #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.