LCOV - code coverage report
Current view: top level - gcc/rust/resolve - rust-ast-resolve-stmt.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 87.9 % 33 29
Test Date: 2025-04-19 15:48:17 Functions: 83.3 % 6 5
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : // Copyright (C) 2020-2025 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-resolve-toplevel.h"
      20                 :             : #include "rust-ast-resolve-item.h"
      21                 :             : #include "rust-ast-resolve-stmt.h"
      22                 :             : #include "rust-ast-resolve-implitem.h"
      23                 :             : 
      24                 :             : namespace Rust {
      25                 :             : namespace Resolver {
      26                 :             : 
      27                 :             : void
      28                 :          23 : ResolveStmt::visit (AST::ExternBlock &extern_block)
      29                 :             : {
      30                 :          23 :   resolve_visibility (extern_block.get_visibility ());
      31                 :          46 :   for (auto &item : extern_block.get_extern_items ())
      32                 :             :     {
      33                 :          23 :       ResolveToplevelExternItem::go (*item, CanonicalPath::create_empty ());
      34                 :          23 :       ResolveExternItem::go (*item, prefix, canonical_prefix);
      35                 :             :     }
      36                 :          23 : }
      37                 :             : 
      38                 :             : void
      39                 :           6 : ResolveStmt::visit (AST::Trait &trait)
      40                 :             : {
      41                 :           6 :   ResolveTopLevel::go (trait, prefix, canonical_prefix);
      42                 :           6 :   ResolveItem::go (trait, prefix, canonical_prefix);
      43                 :           6 : }
      44                 :             : 
      45                 :             : void
      46                 :           1 : ResolveStmt::visit (AST::InherentImpl &impl_block)
      47                 :             : {
      48                 :           1 :   ResolveTopLevel::go (impl_block, prefix, canonical_prefix);
      49                 :           1 :   ResolveItem::go (impl_block, prefix, canonical_prefix);
      50                 :           1 : }
      51                 :             : 
      52                 :             : void
      53                 :           5 : ResolveStmt::visit (AST::TraitImpl &impl_block)
      54                 :             : {
      55                 :           5 :   ResolveTopLevel::go (impl_block, prefix, canonical_prefix);
      56                 :           5 :   ResolveItem::go (impl_block, prefix, canonical_prefix);
      57                 :           5 : }
      58                 :             : 
      59                 :             : void
      60                 :           1 : ResolveStmt::visit (AST::StaticItem &var)
      61                 :             : {
      62                 :           1 :   auto decl = CanonicalPath::new_seg (var.get_node_id (),
      63                 :           1 :                                       var.get_identifier ().as_string ());
      64                 :           1 :   auto path = decl;
      65                 :           1 :   auto cpath = canonical_prefix.append (decl);
      66                 :           1 :   mappings.insert_canonical_path (var.get_node_id (), cpath);
      67                 :             : 
      68                 :           1 :   resolver->get_name_scope ().insert (
      69                 :             :     path, var.get_node_id (), var.get_locus (), false, Rib::ItemType::Static,
      70                 :           1 :     [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
      71                 :           0 :       rich_location r (line_table, var.get_locus ());
      72                 :           0 :       r.add_range (locus);
      73                 :           0 :       redefined_error (r);
      74                 :           0 :     });
      75                 :             : 
      76                 :           1 :   ResolveType::go (var.get_type ());
      77                 :           1 :   ResolveExpr::go (var.get_expr (), path, cpath);
      78                 :           1 : }
      79                 :             : 
      80                 :             : } // namespace Resolver
      81                 :             : } // 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.