LCOV - code coverage report
Current view: top level - gcc/rust/backend - rust-compile-item.h (source / functions) Coverage Total Hit
Test: gcc.info Lines: 55.6 % 27 15
Test Date: 2025-06-21 16:26:05 Functions: 36.8 % 19 7
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : // Copyright (C) 2020-2025 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_COMPILE_ITEM
      20                 :             : #define RUST_COMPILE_ITEM
      21                 :             : 
      22                 :             : #include "rust-compile-base.h"
      23                 :             : #include "rust-hir-visitor.h"
      24                 :             : 
      25                 :             : namespace Rust {
      26                 :             : namespace Compile {
      27                 :             : 
      28                 :       20898 : class CompileItem : private HIRCompileBase, protected HIR::HIRStmtVisitor
      29                 :             : {
      30                 :             : protected:
      31                 :             : public:
      32                 :       20899 :   static tree compile (HIR::Item *item, Context *ctx,
      33                 :             :                        TyTy::BaseType *concrete = nullptr,
      34                 :             :                        location_t ref_locus = UNDEF_LOCATION)
      35                 :             :   {
      36                 :       20899 :     CompileItem compiler (ctx, concrete, ref_locus);
      37                 :       20899 :     item->accept_vis (compiler);
      38                 :       20898 :     return compiler.reference;
      39                 :       20898 :   }
      40                 :             : 
      41                 :             :   void visit (HIR::StaticItem &var) override;
      42                 :             :   void visit (HIR::ConstantItem &constant) override;
      43                 :             :   void visit (HIR::Function &function) override;
      44                 :             :   void visit (HIR::ImplBlock &impl_block) override;
      45                 :             :   void visit (HIR::ExternBlock &extern_block) override;
      46                 :             :   void visit (HIR::Module &module) override;
      47                 :             : 
      48                 :             :   // Empty visit for unused Stmt HIR nodes.
      49                 :         797 :   void visit (HIR::TupleStruct &) override {}
      50                 :           0 :   void visit (HIR::EnumItem &) override {}
      51                 :           0 :   void visit (HIR::EnumItemTuple &) override {}
      52                 :           0 :   void visit (HIR::EnumItemStruct &) override {}
      53                 :           0 :   void visit (HIR::EnumItemDiscriminant &) override {}
      54                 :           0 :   void visit (HIR::TypePathSegmentFunction &) override {}
      55                 :           0 :   void visit (HIR::TypePath &) override {}
      56                 :           0 :   void visit (HIR::QualifiedPathInType &) override {}
      57                 :           0 :   void visit (HIR::ExternCrate &) override {}
      58                 :           0 :   void visit (HIR::UseDeclaration &) override {}
      59                 :        1233 :   void visit (HIR::TypeAlias &) override {}
      60                 :        1138 :   void visit (HIR::StructStruct &) override {}
      61                 :         318 :   void visit (HIR::Enum &) override {}
      62                 :          95 :   void visit (HIR::Union &) override {}
      63                 :        2907 :   void visit (HIR::Trait &) override {}
      64                 :           0 :   void visit (HIR::EmptyStmt &) override {}
      65                 :           0 :   void visit (HIR::LetStmt &) override {}
      66                 :           0 :   void visit (HIR::ExprStmt &) override {}
      67                 :             : 
      68                 :             : protected:
      69                 :       29087 :   CompileItem (Context *ctx, TyTy::BaseType *concrete, location_t ref_locus)
      70                 :       29087 :     : HIRCompileBase (ctx), concrete (concrete), reference (error_mark_node),
      71                 :       29087 :       ref_locus (ref_locus)
      72                 :             :   {}
      73                 :             : 
      74                 :             :   TyTy::BaseType *concrete;
      75                 :             :   tree reference;
      76                 :             :   location_t ref_locus;
      77                 :             : };
      78                 :             : 
      79                 :             : } // namespace Compile
      80                 :             : } // namespace Rust
      81                 :             : 
      82                 :             : #endif // RUST_COMPILE_ITEM
        

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.