LCOV - code coverage report
Current view: top level - gcc/rust/ast - rust-ast-dump.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 50.0 % 20 10
Test Date: 2024-04-20 14:03:02 Functions: 50.0 % 6 3
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-dump.h"
      20                 :             : #include "rust-expr.h"
      21                 :             : 
      22                 :             : namespace Rust {
      23                 :             : namespace AST {
      24                 :             : 
      25                 :        2052 : Dump::Dump (std::ostream &stream) : stream (stream), indentation (Indent ()) {}
      26                 :             : 
      27                 :             : bool
      28                 :       36539 : Dump::require_spacing (TokenPtr previous, TokenPtr current)
      29                 :             : {
      30                 :       36539 :   if (previous == nullptr)
      31                 :             :     {
      32                 :             :       return false;
      33                 :             :     }
      34                 :             : 
      35                 :       30713 :   switch (current->get_id ())
      36                 :             :     {
      37                 :             :     case EXCLAM:
      38                 :             :     case DOT_DOT:
      39                 :             :     case DOT_DOT_EQ:
      40                 :             :     case SCOPE_RESOLUTION:
      41                 :             :     case LEFT_PAREN:
      42                 :             :     case LEFT_ANGLE:
      43                 :             :     case LEFT_SQUARE:
      44                 :             :     case RIGHT_SQUARE:
      45                 :             :     case RIGHT_PAREN:
      46                 :             :     case SEMICOLON:
      47                 :             :     case COMMA:
      48                 :             :     case DOT:
      49                 :             :       return false;
      50                 :       21752 :     default:
      51                 :       21752 :       break;
      52                 :             :     }
      53                 :             : 
      54                 :       21752 :   switch (previous->get_id ())
      55                 :             :     {
      56                 :             :     case SCOPE_RESOLUTION:
      57                 :             :     case DOLLAR_SIGN:
      58                 :             :     case LEFT_SQUARE:
      59                 :             :     case LEFT_PAREN:
      60                 :             :     case AMP:
      61                 :             :     case DOT:
      62                 :             :       return false;
      63                 :             :     default:
      64                 :             :       return true;
      65                 :             :     }
      66                 :             : }
      67                 :             : 
      68                 :             : void
      69                 :           0 : Dump::debug (Visitable &v)
      70                 :             : {
      71                 :           0 :   Dump dump (std::cerr);
      72                 :           0 :   dump.process (v);
      73                 :           0 : }
      74                 :             : 
      75                 :             : void
      76                 :           0 : Dump::go (AST::Crate &crate)
      77                 :             : {
      78                 :           0 :   process (crate);
      79                 :           0 : }
      80                 :             : 
      81                 :             : void
      82                 :        2052 : Dump::go (AST::Item &item)
      83                 :             : {
      84                 :        2052 :   process (item);
      85                 :        2052 : }
      86                 :             : 
      87                 :             : } // namespace AST
      88                 :             : } // namespace Rust
      89                 :             : 
      90                 :             : void
      91                 :           0 : debug (Rust::AST::Visitable &v)
      92                 :             : {
      93                 :           0 :   Rust::AST::Dump::debug (v);
      94                 :           0 : }
        

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.