LCOV - code coverage report
Current view: top level - gcc/rust/resolve - rust-identifier-path.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 100.0 % 21 21
Test Date: 2026-04-20 14:57:17 Functions: 100.0 % 3 3
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              : #include "rust-identifier-path.h"
      21              : #include "rust-pattern.h"
      22              : 
      23              : namespace Rust {
      24              : namespace Resolver2_0 {
      25              : 
      26        10779 : IdentifierPathPass::IdentifierPathPass (NameResolutionContext &ctx,
      27        10779 :                                         std::set<NodeId> ident_path_to_convert)
      28        10779 :   : ctx (&ctx), ident_path_to_convert (std::move (ident_path_to_convert))
      29        10779 : {}
      30              : 
      31              : void
      32        10779 : IdentifierPathPass::go (AST::Crate &crate, NameResolutionContext &ctx,
      33              :                         std::set<NodeId> ident_path_to_convert)
      34              : {
      35        10779 :   IdentifierPathPass pass (ctx, std::move (ident_path_to_convert));
      36        10779 :   pass.visit (crate);
      37        10779 : }
      38              : 
      39              : void
      40        60720 : IdentifierPathPass::reseat (std::unique_ptr<AST::Pattern> &ptr)
      41              : {
      42        60720 :   AST::IdentifierPattern *ident_pat;
      43        60720 :   if (ptr->get_pattern_kind () == AST::Pattern::Kind::Identifier)
      44        53284 :     ident_pat = static_cast<AST::IdentifierPattern *> (ptr.get ());
      45              :   else
      46              :     return;
      47              : 
      48        53284 :   if (ident_path_to_convert.find (ident_pat->get_node_id ())
      49        53284 :       != ident_path_to_convert.end ())
      50              :     {
      51           22 :       std::vector<AST::PathExprSegment> segments;
      52           22 :       segments.emplace_back (ident_pat->get_ident ().as_string (),
      53           22 :                              ident_pat->get_locus ());
      54           44 :       ptr = std::make_unique<AST::PathInExpression> (
      55           22 :         std::move (segments), std::vector<AST::Attribute> (),
      56           22 :         ident_pat->get_locus ());
      57           22 :     }
      58              : }
      59              : 
      60              : } // namespace Resolver2_0
      61              : } // namespace Rust
        

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.