LCOV - code coverage report
Current view: top level - gcc/rust/expand - rust-derive-partial-eq.h (source / functions) Coverage Total Hit
Test: gcc.info Lines: 100.0 % 2 2
Test Date: 2025-06-21 16:26:05 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) 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_DERIVE_PARTIAL_EQ_H
      20                 :             : #define RUST_DERIVE_PARTIAL_EQ_H
      21                 :             : 
      22                 :             : #include "rust-derive.h"
      23                 :             : #include "rust-path.h"
      24                 :             : 
      25                 :             : namespace Rust {
      26                 :             : namespace AST {
      27                 :             : 
      28                 :          31 : class DerivePartialEq : DeriveVisitor
      29                 :             : {
      30                 :             : public:
      31                 :             :   DerivePartialEq (location_t loc);
      32                 :             : 
      33                 :             :   std::vector<std::unique_ptr<AST::Item>> go (Item &item);
      34                 :             : 
      35                 :             : private:
      36                 :             :   std::vector<std::unique_ptr<Item>> expanded;
      37                 :             : 
      38                 :             :   /**
      39                 :             :    * Generate both an implementation of `PartialEq` and `StructuralPartialEq`
      40                 :             :    * for the given type
      41                 :             :    */
      42                 :             :   std::vector<std::unique_ptr<Item>> partialeq_impls (
      43                 :             :     std::unique_ptr<AssociatedItem> &&eq_fn, std::string name,
      44                 :             :     const std::vector<std::unique_ptr<GenericParam>> &type_generics);
      45                 :             : 
      46                 :             :   std::unique_ptr<AssociatedItem> eq_fn (std::unique_ptr<Expr> &&cmp_expression,
      47                 :             :                                          std::string type_name);
      48                 :             : 
      49                 :             :   /**
      50                 :             :    * A pair of two expressions from each instance being compared. E.g. this
      51                 :             :    * could be `self.0` and `other.0`, or `self.field` and `other.field`
      52                 :             :    */
      53                 :          60 :   struct SelfOther
      54                 :             :   {
      55                 :             :     std::unique_ptr<Expr> self_expr;
      56                 :             :     std::unique_ptr<Expr> other_expr;
      57                 :             :   };
      58                 :             : 
      59                 :             :   SelfOther tuple_indexes (int idx);
      60                 :             :   SelfOther field_acccesses (const std::string &field_name);
      61                 :             : 
      62                 :             :   /**
      63                 :             :    * Build a suite of equality arithmetic expressions chained together by a
      64                 :             :    * boolean AND operator
      65                 :             :    */
      66                 :             :   std::unique_ptr<Expr>
      67                 :             :   build_eq_expression (std::vector<SelfOther> &&field_expressions);
      68                 :             : 
      69                 :             :   MatchCase match_enum_identifier (PathInExpression variant_path,
      70                 :             :                                    const std::unique_ptr<EnumItem> &variant);
      71                 :             :   MatchCase match_enum_tuple (PathInExpression variant_path,
      72                 :             :                               const EnumItemTuple &variant);
      73                 :             :   MatchCase match_enum_struct (PathInExpression variant_path,
      74                 :             :                                const EnumItemStruct &variant);
      75                 :             : 
      76                 :             :   virtual void visit_struct (StructStruct &item);
      77                 :             :   virtual void visit_tuple (TupleStruct &item);
      78                 :             :   virtual void visit_enum (Enum &item);
      79                 :             :   virtual void visit_union (Union &item);
      80                 :             : };
      81                 :             : 
      82                 :             : } // namespace AST
      83                 :             : } // namespace Rust
      84                 :             : 
      85                 :             : #endif // ! RUST_DERIVE_PARTIAL_EQ_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.