LCOV - code coverage report
Current view: top level - gcc/rust/hir - rust-ast-lower-type.h (source / functions) Coverage Total Hit
Test: gcc.info Lines: 100.0 % 13 13
Test Date: 2024-04-20 14:03:02 Functions: - 0 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-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                 :             : #ifndef RUST_AST_LOWER_TYPE
      20                 :             : #define RUST_AST_LOWER_TYPE
      21                 :             : 
      22                 :             : #include "rust-ast-lower-base.h"
      23                 :             : #include "rust-ast-lower-expr.h"
      24                 :             : 
      25                 :             : namespace Rust {
      26                 :             : namespace HIR {
      27                 :             : 
      28                 :       30218 : class ASTLowerTypePath : public ASTLoweringBase
      29                 :             : {
      30                 :             : protected:
      31                 :             :   using Rust::HIR::ASTLoweringBase::visit;
      32                 :             : 
      33                 :             : public:
      34                 :             :   static HIR::TypePath *translate (AST::TypePath &type);
      35                 :             : 
      36                 :             :   void visit (AST::TypePathSegmentFunction &segment) override;
      37                 :             :   void visit (AST::TypePathSegment &segment) override;
      38                 :             :   void visit (AST::TypePathSegmentGeneric &segment) override;
      39                 :             :   void visit (AST::TypePath &path) override;
      40                 :             : 
      41                 :             : protected:
      42                 :             :   HIR::TypePathSegment *translated_segment;
      43                 :             : 
      44                 :             : private:
      45                 :             :   HIR::TypePath *translated;
      46                 :             : };
      47                 :             : 
      48                 :         159 : class ASTLowerQualifiedPathInType : public ASTLowerTypePath
      49                 :             : {
      50                 :             :   using ASTLowerTypePath::visit;
      51                 :             : 
      52                 :             : public:
      53                 :             :   static HIR::QualifiedPathInType *translate (AST::QualifiedPathInType &type);
      54                 :             : 
      55                 :             :   void visit (AST::QualifiedPathInType &path) override;
      56                 :             : 
      57                 :             : private:
      58                 :             :   HIR::QualifiedPathInType *translated;
      59                 :             : };
      60                 :             : 
      61                 :       35414 : class ASTLoweringType : public ASTLoweringBase
      62                 :             : {
      63                 :             :   using Rust::HIR::ASTLoweringBase::visit;
      64                 :             : 
      65                 :             : public:
      66                 :             :   static HIR::Type *translate (AST::Type *type,
      67                 :             :                                bool default_to_static_lifetime = false);
      68                 :             : 
      69                 :             :   void visit (AST::BareFunctionType &fntype) override;
      70                 :             :   void visit (AST::TupleType &tuple) override;
      71                 :             :   void visit (AST::TypePath &path) override;
      72                 :             :   void visit (AST::QualifiedPathInType &path) override;
      73                 :             :   void visit (AST::ArrayType &type) override;
      74                 :             :   void visit (AST::ReferenceType &type) override;
      75                 :             :   void visit (AST::RawPointerType &type) override;
      76                 :             :   void visit (AST::SliceType &type) override;
      77                 :             :   void visit (AST::InferredType &type) override;
      78                 :             :   void visit (AST::NeverType &type) override;
      79                 :             :   void visit (AST::TraitObjectTypeOneBound &type) override;
      80                 :             :   void visit (AST::TraitObjectType &type) override;
      81                 :             : 
      82                 :             : private:
      83                 :       35414 :   ASTLoweringType (bool default_to_static_lifetime)
      84                 :       35414 :     : ASTLoweringBase (),
      85                 :       35414 :       default_to_static_lifetime (default_to_static_lifetime),
      86                 :       35414 :       translated (nullptr)
      87                 :             :   {}
      88                 :             : 
      89                 :             :   /** Used when compiling const and static items. */
      90                 :             :   bool default_to_static_lifetime;
      91                 :             : 
      92                 :             :   HIR::Type *translated;
      93                 :             : };
      94                 :             : 
      95                 :        4998 : class ASTLowerGenericParam : public ASTLoweringBase
      96                 :             : {
      97                 :             :   using Rust::HIR::ASTLoweringBase::visit;
      98                 :             : 
      99                 :             : public:
     100                 :             :   static HIR::GenericParam *translate (AST::GenericParam *param);
     101                 :             : 
     102                 :             :   void visit (AST::LifetimeParam &param) override;
     103                 :             :   void visit (AST::ConstGenericParam &param) override;
     104                 :             :   void visit (AST::TypeParam &param) override;
     105                 :             : 
     106                 :             : private:
     107                 :        4998 :   ASTLowerGenericParam () : ASTLoweringBase (), translated (nullptr) {}
     108                 :             : 
     109                 :             :   HIR::GenericParam *translated;
     110                 :             : };
     111                 :             : 
     112                 :         597 : class ASTLoweringTypeBounds : public ASTLoweringBase
     113                 :             : {
     114                 :             :   using Rust::HIR::ASTLoweringBase::visit;
     115                 :             : 
     116                 :             : public:
     117                 :             :   static HIR::TypeParamBound *translate (AST::TypeParamBound *type);
     118                 :             : 
     119                 :             :   void visit (AST::TraitBound &bound) override;
     120                 :             :   void visit (AST::Lifetime &bound) override;
     121                 :             : 
     122                 :             : private:
     123                 :         597 :   ASTLoweringTypeBounds () : ASTLoweringBase (), translated (nullptr) {}
     124                 :             : 
     125                 :             :   HIR::TypeParamBound *translated;
     126                 :             : };
     127                 :             : 
     128                 :          81 : class ASTLowerWhereClauseItem : public ASTLoweringBase
     129                 :             : {
     130                 :             :   using Rust::HIR::ASTLoweringBase::visit;
     131                 :             : 
     132                 :             : public:
     133                 :             :   static HIR::WhereClauseItem *translate (AST::WhereClauseItem &item);
     134                 :             : 
     135                 :             :   void visit (AST::LifetimeWhereClauseItem &item) override;
     136                 :             :   void visit (AST::TypeBoundWhereClauseItem &item) override;
     137                 :             : 
     138                 :             : private:
     139                 :          81 :   ASTLowerWhereClauseItem () : ASTLoweringBase (), translated (nullptr) {}
     140                 :             : 
     141                 :             :   HIR::WhereClauseItem *translated;
     142                 :             : };
     143                 :             : 
     144                 :             : } // namespace HIR
     145                 :             : } // namespace Rust
     146                 :             : 
     147                 :             : #endif // RUST_AST_LOWER_TYPE
        

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.