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: 2026-02-28 14:20:25 Functions: 66.7 % 3 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_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         9602 : class CompileInherentImplItem : public CompileItem
      29              : {
      30              : public:
      31         9602 :   static tree Compile (HIR::ImplItem *item, Context *ctx,
      32              :                        TyTy::BaseType *concrete = nullptr,
      33              :                        location_t ref_locus = UNDEF_LOCATION)
      34              :   {
      35         9602 :     CompileInherentImplItem compiler (ctx, concrete, ref_locus);
      36         9602 :     item->accept_vis (compiler);
      37         9602 :     return compiler.reference;
      38         9602 :   }
      39              : 
      40              : private:
      41         9602 :   CompileInherentImplItem (Context *ctx, TyTy::BaseType *concrete,
      42              :                            location_t ref_locus)
      43         9602 :     : CompileItem (ctx, concrete, ref_locus)
      44              :   {}
      45              : };
      46              : 
      47          255 : class CompileTraitItem : public HIRCompileBase, public HIR::HIRTraitItemVisitor
      48              : {
      49              : public:
      50          255 :   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          255 :     CompileTraitItem compiler (ctx, concrete, ref_locus);
      55          255 :     item->accept_vis (compiler);
      56              : 
      57          255 :     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->to_string ().c_str ());
      60              : 
      61          255 :     return compiler.reference;
      62          255 :   }
      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          255 :   CompileTraitItem (Context *ctx, TyTy::BaseType *concrete,
      71              :                     location_t ref_locus)
      72          255 :     : HIRCompileBase (ctx), concrete (concrete), reference (error_mark_node),
      73          255 :       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.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.