LCOV - code coverage report
Current view: top level - gcc/rust/backend - rust-compile-implitem.h (source / functions) Coverage Total Hit
Test: gcc.info Lines: 85.7 % 21 18
Test Date: 2025-06-21 16:26:05 Functions: 66.7 % 3 2
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_IMPLITEM_H
      20                 :             : #define RUST_COMPILE_IMPLITEM_H
      21                 :             : 
      22                 :             : #include "rust-compile-item.h"
      23                 :             : 
      24                 :             : namespace Rust {
      25                 :             : namespace Compile {
      26                 :             : 
      27                 :             : // this is a proxy for HIR::ImplItem's back to use the normal HIR::Item path
      28                 :        8188 : class CompileInherentImplItem : public CompileItem
      29                 :             : {
      30                 :             : public:
      31                 :        8188 :   static tree Compile (HIR::ImplItem *item, Context *ctx,
      32                 :             :                        TyTy::BaseType *concrete = nullptr,
      33                 :             :                        location_t ref_locus = UNDEF_LOCATION)
      34                 :             :   {
      35                 :        8188 :     CompileInherentImplItem compiler (ctx, concrete, ref_locus);
      36                 :        8188 :     item->accept_vis (compiler);
      37                 :        8188 :     return compiler.reference;
      38                 :        8188 :   }
      39                 :             : 
      40                 :             : private:
      41                 :        8188 :   CompileInherentImplItem (Context *ctx, TyTy::BaseType *concrete,
      42                 :             :                            location_t ref_locus)
      43                 :        8188 :     : CompileItem (ctx, concrete, ref_locus)
      44                 :             :   {}
      45                 :             : };
      46                 :             : 
      47                 :         172 : class CompileTraitItem : public HIRCompileBase, public HIR::HIRTraitItemVisitor
      48                 :             : {
      49                 :             : public:
      50                 :         172 :   static tree Compile (HIR::TraitItem *item, Context *ctx,
      51                 :             :                        TyTy::BaseType *concrete, bool is_query_mode = false,
      52                 :             :                        location_t ref_locus = UNDEF_LOCATION)
      53                 :             :   {
      54                 :         172 :     CompileTraitItem compiler (ctx, concrete, ref_locus);
      55                 :         172 :     item->accept_vis (compiler);
      56                 :             : 
      57                 :         172 :     if (is_query_mode && compiler.reference == error_mark_node)
      58                 :           0 :       rust_internal_error_at (ref_locus, "failed to compile trait item: %s",
      59                 :           0 :                               item->as_string ().c_str ());
      60                 :             : 
      61                 :         172 :     return compiler.reference;
      62                 :         172 :   }
      63                 :             : 
      64                 :             :   void visit (HIR::TraitItemConst &constant) override;
      65                 :             :   void visit (HIR::TraitItemFunc &func) override;
      66                 :             : 
      67                 :           0 :   void visit (HIR::TraitItemType &typ) override {}
      68                 :             : 
      69                 :             : private:
      70                 :         172 :   CompileTraitItem (Context *ctx, TyTy::BaseType *concrete,
      71                 :             :                     location_t ref_locus)
      72                 :         172 :     : HIRCompileBase (ctx), concrete (concrete), reference (error_mark_node),
      73                 :         172 :       ref_locus (ref_locus)
      74                 :             :   {}
      75                 :             : 
      76                 :             :   TyTy::BaseType *concrete;
      77                 :             :   tree reference;
      78                 :             :   location_t ref_locus;
      79                 :             : };
      80                 :             : 
      81                 :             : } // namespace Compile
      82                 :             : } // namespace Rust
      83                 :             : 
      84                 :             : #endif // RUST_COMPILE_IMPLITEM_H
        

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.