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

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.