LCOV - code coverage report
Current view: top level - gcc/rust/hir/tree - rust-hir-type-abstract.h (source / functions) Coverage Total Hit
Test: gcc.info Lines: 75.0 % 12 9
Test Date: 2026-02-28 14:20:25 Functions: 50.0 % 4 2
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_TYPE_ABSTRACT_H
      20              : #define RUST_HIR_TYPE_ABSTRACT_H
      21              : 
      22              : #include "rust-hir-node.h"
      23              : #include "rust-hir-visitable.h"
      24              : #include "rust-system.h"
      25              : #include "rust-hir-map.h"
      26              : 
      27              : namespace Rust {
      28              : namespace HIR {
      29              : 
      30              : class TraitBound;
      31              : 
      32              : // Base class for types as represented in HIR - abstract
      33         3079 : class Type : public Node, public FullVisitable
      34              : {
      35              : public:
      36              :   using FullVisitable::accept_vis;
      37              :   // Unique pointer custom clone function
      38        14134 :   std::unique_ptr<Type> clone_type () const
      39              :   {
      40        14134 :     return std::unique_ptr<Type> (clone_type_impl ());
      41              :   }
      42              : 
      43              :   // virtual destructor
      44         3079 :   virtual ~Type () {}
      45              : 
      46            0 :   BaseKind get_hir_kind () override final { return TYPE; }
      47              : 
      48              :   virtual std::string to_string () const = 0;
      49              : 
      50            0 :   std::string to_debug_string () const
      51              :   {
      52            0 :     return to_string () + mappings.as_string ();
      53              :   }
      54              : 
      55              :   /* HACK: convert to trait bound. Virtual method overriden by classes that
      56              :    * enable this. */
      57              :   virtual std::unique_ptr<TraitBound>
      58              :   to_trait_bound (bool in_parens ATTRIBUTE_UNUSED) const;
      59              :   /* as pointer, shouldn't require definition beforehand, only forward
      60              :    * declaration. */
      61              : 
      62              :   virtual void accept_vis (HIRTypeVisitor &vis) = 0;
      63              : 
      64      4772827 :   virtual const Analysis::NodeMapping &get_mappings () const
      65              :   {
      66      4772827 :     return mappings;
      67              :   }
      68       152152 :   virtual location_t get_locus () const { return locus; }
      69              : 
      70              : protected:
      71        84725 :   Type (Analysis::NodeMapping mappings, location_t locus)
      72        20790 :     : mappings (mappings), locus (locus)
      73              :   {}
      74              : 
      75              :   // Clone function implementation as pure virtual method
      76              :   virtual Type *clone_type_impl () const = 0;
      77              : 
      78              :   Analysis::NodeMapping mappings;
      79              :   location_t locus;
      80              : };
      81              : 
      82              : } // namespace HIR
      83              : } // namespace Rust
      84              : 
      85              : #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.