LCOV - code coverage report
Current view: top level - gcc/rust/util - rust-raw-path.h (source / functions) Coverage Total Hit
Test: gcc.info Lines: 100.0 % 15 15
Test Date: 2026-12-05 16:10:02 Functions: 100.0 % 2 2
Legend: Lines:     hit not hit

            Line data    Source code
       1              : // Copyright (C) 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-system.h"
      20              : 
      21              : #ifndef RUST_RAW_PATH_H
      22              : #define RUST_RAW_PATH_H
      23              : 
      24              : namespace Rust {
      25              : 
      26     83811758 : template <typename Segment> class RawPath
      27              : {
      28              : protected:
      29              :   std::vector<Segment> segments;
      30              :   bool opening_scope_resolution;
      31              : 
      32              : public:
      33     25667681 :   RawPath (std::vector<Segment> segments, bool opening_scope_resolution)
      34     22596009 :     : segments (std::move (segments)),
      35     25667681 :       opening_scope_resolution (opening_scope_resolution)
      36              :   {}
      37              : 
      38              :   /* Returns whether the RawPath has an opening scope resolution operator
      39              :    * (i.e. is global path or crate-relative path, not module-relative) */
      40     12942614 :   bool has_opening_scope_resolution () const
      41              :   {
      42     12942614 :     return opening_scope_resolution;
      43              :   }
      44              : 
      45      6952161 :   const std::vector<Segment> &get_segments () const { return segments; }
      46    461402088 :   std::vector<Segment> &get_segments () { return segments; }
      47              : 
      48      2772293 :   bool is_empty () const { return segments.empty (); }
      49              : 
      50      1322368 :   Segment &get_final_segment ()
      51              :   {
      52      1322368 :     rust_assert (!is_empty ());
      53      1322368 :     return get_segments ().back ();
      54              :   }
      55       221013 :   const Segment &get_final_segment () const
      56              :   {
      57       221013 :     rust_assert (!is_empty ());
      58       221013 :     return get_segments ().back ();
      59              :   }
      60              : };
      61              : 
      62              : } // namespace Rust
      63              : 
      64              : #endif
        

Generated by: LCOV version 2.6-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.