LCOV - code coverage report
Current view: top level - gcc/rust/ast - rust-ast-builder-type.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 0.0 % 72 0
Test Date: 2025-07-05 13:26:22 Functions: 0.0 % 14 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-ast-builder-type.h"
      20                 :             : #include "rust-ast-builder.h"
      21                 :             : #include "rust-ast-full.h"
      22                 :             : #include "rust-common.h"
      23                 :             : 
      24                 :             : namespace Rust {
      25                 :             : namespace AST {
      26                 :             : 
      27                 :           0 : ASTTypeBuilder::ASTTypeBuilder () : translated (nullptr) {}
      28                 :             : 
      29                 :             : Type *
      30                 :           0 : ASTTypeBuilder::build (Type &type)
      31                 :             : {
      32                 :           0 :   ASTTypeBuilder builder;
      33                 :           0 :   type.accept_vis (builder);
      34                 :           0 :   rust_assert (builder.translated != nullptr);
      35                 :           0 :   return builder.translated;
      36                 :             : }
      37                 :             : 
      38                 :             : void
      39                 :           0 : ASTTypeBuilder::visit (BareFunctionType &fntype)
      40                 :             : {
      41                 :             :   /* TODO */
      42                 :           0 : }
      43                 :             : 
      44                 :             : void
      45                 :           0 : ASTTypeBuilder::visit (TupleType &tuple)
      46                 :             : {
      47                 :           0 :   std::vector<std::unique_ptr<Type> > elems;
      48                 :           0 :   for (auto &elem : tuple.get_elems ())
      49                 :             :     {
      50                 :           0 :       Type *t = ASTTypeBuilder::build (*elem.get ());
      51                 :           0 :       std::unique_ptr<Type> ty (t);
      52                 :           0 :       elems.push_back (std::move (ty));
      53                 :           0 :     }
      54                 :           0 :   translated = new TupleType (std::move (elems), tuple.get_locus ());
      55                 :           0 : }
      56                 :             : 
      57                 :             : void
      58                 :           0 : ASTTypeBuilder::visit (TypePath &path)
      59                 :             : {
      60                 :           0 :   std::vector<std::unique_ptr<TypePathSegment> > segments;
      61                 :           0 :   for (auto &seg : path.get_segments ())
      62                 :             :     {
      63                 :           0 :       switch (seg->get_type ())
      64                 :             :         {
      65                 :           0 :           case TypePathSegment::REG: {
      66                 :           0 :             const TypePathSegment &segment
      67                 :           0 :               = (const TypePathSegment &) (*seg.get ());
      68                 :           0 :             TypePathSegment *s
      69                 :             :               = new TypePathSegment (segment.get_ident_segment (),
      70                 :           0 :                                      segment.get_separating_scope_resolution (),
      71                 :           0 :                                      segment.get_locus ());
      72                 :           0 :             std::unique_ptr<TypePathSegment> sg (s);
      73                 :           0 :             segments.push_back (std::move (sg));
      74                 :           0 :           }
      75                 :           0 :           break;
      76                 :             : 
      77                 :           0 :           case TypePathSegment::GENERIC: {
      78                 :           0 :             TypePathSegmentGeneric &generic
      79                 :           0 :               = (TypePathSegmentGeneric &) (*seg.get ());
      80                 :             : 
      81                 :           0 :             GenericArgs args
      82                 :           0 :               = Builder::new_generic_args (generic.get_generic_args ());
      83                 :           0 :             TypePathSegmentGeneric *s
      84                 :           0 :               = new TypePathSegmentGeneric (generic.get_ident_segment (), false,
      85                 :             :                                             std::move (args),
      86                 :           0 :                                             generic.get_locus ());
      87                 :           0 :             std::unique_ptr<TypePathSegment> sg (s);
      88                 :           0 :             segments.push_back (std::move (sg));
      89                 :           0 :           }
      90                 :           0 :           break;
      91                 :             : 
      92                 :           0 :           case TypePathSegment::FUNCTION: {
      93                 :           0 :             rust_unreachable ();
      94                 :             :             // TODO
      95                 :             :             // const TypePathSegmentFunction &fn
      96                 :             :             //   = (const TypePathSegmentFunction &) (*seg.get ());
      97                 :             :           }
      98                 :           0 :           break;
      99                 :             :         }
     100                 :             :     }
     101                 :             : 
     102                 :           0 :   translated = new TypePath (std::move (segments), path.get_locus (),
     103                 :           0 :                              path.has_opening_scope_resolution_op ());
     104                 :           0 : }
     105                 :             : 
     106                 :             : void
     107                 :           0 : ASTTypeBuilder::visit (QualifiedPathInType &path)
     108                 :             : {
     109                 :             :   /* TODO */
     110                 :           0 : }
     111                 :             : 
     112                 :             : void
     113                 :           0 : ASTTypeBuilder::visit (ArrayType &type)
     114                 :             : {
     115                 :             :   /* TODO */
     116                 :           0 : }
     117                 :             : 
     118                 :             : void
     119                 :           0 : ASTTypeBuilder::visit (ReferenceType &type)
     120                 :             : {
     121                 :             :   /* TODO */
     122                 :           0 : }
     123                 :             : 
     124                 :             : void
     125                 :           0 : ASTTypeBuilder::visit (RawPointerType &type)
     126                 :             : {
     127                 :             :   /* TODO */
     128                 :           0 : }
     129                 :             : 
     130                 :             : void
     131                 :           0 : ASTTypeBuilder::visit (SliceType &type)
     132                 :             : {
     133                 :           0 :   Type *t = ASTTypeBuilder::build (type.get_elem_type ());
     134                 :           0 :   std::unique_ptr<Type> ty (t);
     135                 :           0 :   translated = new SliceType (std::move (ty), type.get_locus ());
     136                 :           0 : }
     137                 :             : 
     138                 :             : void
     139                 :           0 : ASTTypeBuilder::visit (InferredType &type)
     140                 :             : {
     141                 :           0 :   translated = new InferredType (type.get_locus ());
     142                 :           0 : }
     143                 :             : 
     144                 :             : void
     145                 :           0 : ASTTypeBuilder::visit (NeverType &type)
     146                 :             : {
     147                 :           0 :   translated = new NeverType (type.get_locus ());
     148                 :           0 : }
     149                 :             : 
     150                 :             : void
     151                 :           0 : ASTTypeBuilder::visit (TraitObjectTypeOneBound &type)
     152                 :             : {
     153                 :             :   /* TODO */
     154                 :           0 : }
     155                 :             : 
     156                 :             : void
     157                 :           0 : ASTTypeBuilder::visit (TraitObjectType &type)
     158                 :             : {
     159                 :             :   /* TODO */
     160                 :           0 : }
     161                 :             : 
     162                 :             : } // namespace AST
     163                 :             : } // 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.