LCOV - code coverage report
Current view: top level - gcc/rust/expand - rust-derive-copy.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 0.0 % 28 0
Test Date: 2024-04-27 14:03:13 Functions: 0.0 % 7 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                 :             : #include "rust-derive-copy.h"
      20                 :             : #include "rust-ast-full.h"
      21                 :             : 
      22                 :             : namespace Rust {
      23                 :             : namespace AST {
      24                 :             : 
      25                 :           0 : DeriveCopy::DeriveCopy (location_t loc)
      26                 :           0 :   : DeriveVisitor (loc), expanded (nullptr)
      27                 :           0 : {}
      28                 :             : 
      29                 :             : std::unique_ptr<AST::Item>
      30                 :           0 : DeriveCopy::go (Item &item)
      31                 :             : {
      32                 :           0 :   item.accept_vis (*this);
      33                 :             : 
      34                 :           0 :   rust_assert (expanded);
      35                 :             : 
      36                 :           0 :   return std::move (expanded);
      37                 :             : }
      38                 :             : 
      39                 :             : std::unique_ptr<Item>
      40                 :           0 : DeriveCopy::copy_impl (std::string name)
      41                 :             : {
      42                 :             :   // `$crate::core::marker::Copy` instead
      43                 :           0 :   auto segments = std::vector<std::unique_ptr<TypePathSegment>> ();
      44                 :           0 :   segments.emplace_back (builder.type_path_segment ("Copy"));
      45                 :           0 :   auto copy = TypePath (std::move (segments), loc);
      46                 :             : 
      47                 :           0 :   return std::unique_ptr<Item> (
      48                 :             :     new TraitImpl (copy, /* unsafe */ false,
      49                 :             :                    /* exclam */ false, /* trait items */ {},
      50                 :           0 :                    /* generics */ {}, builder.single_type_path (name),
      51                 :           0 :                    WhereClause::create_empty (), Visibility::create_private (),
      52                 :           0 :                    {}, {}, loc));
      53                 :           0 : }
      54                 :             : 
      55                 :             : void
      56                 :           0 : DeriveCopy::visit_struct (StructStruct &item)
      57                 :             : {
      58                 :           0 :   expanded = copy_impl (item.get_struct_name ().as_string ());
      59                 :           0 : }
      60                 :             : 
      61                 :             : void
      62                 :           0 : DeriveCopy::visit_tuple (TupleStruct &item)
      63                 :             : {
      64                 :           0 :   expanded = copy_impl (item.get_struct_name ().as_string ());
      65                 :           0 : }
      66                 :             : 
      67                 :             : void
      68                 :           0 : DeriveCopy::visit_enum (Enum &item)
      69                 :             : {
      70                 :           0 :   expanded = copy_impl (item.get_identifier ().as_string ());
      71                 :           0 : }
      72                 :             : 
      73                 :             : void
      74                 :           0 : DeriveCopy::visit_union (Union &item)
      75                 :             : {
      76                 :           0 :   expanded = copy_impl (item.get_identifier ().as_string ());
      77                 :           0 : }
      78                 :             : 
      79                 :             : } // namespace AST
      80                 :             : } // namespace Rust
        

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.