LCOV - code coverage report
Current view: top level - gcc/rust/resolve - rust-finalize-imports-2.0.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 25.5 % 47 12
Test Date: 2025-06-21 16:26:05 Functions: 25.0 % 12 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-finalize-imports-2.0.h"
      20                 :             : #include "rust-default-resolver.h"
      21                 :             : #include "rust-hir-map.h"
      22                 :             : #include "rust-name-resolution-context.h"
      23                 :             : #include "rust-rib.h"
      24                 :             : #include "rust-toplevel-name-resolver-2.0.h"
      25                 :             : 
      26                 :             : namespace Rust {
      27                 :             : namespace Resolver2_0 {
      28                 :             : 
      29                 :             : void
      30                 :          18 : GlobbingVisitor::go (AST::Module *module)
      31                 :             : {
      32                 :          50 :   for (auto &i : module->get_items ())
      33                 :          32 :     visit (i);
      34                 :          18 : }
      35                 :             : 
      36                 :             : void
      37                 :          12 : GlobbingVisitor::visit (AST::Module &module)
      38                 :             : {
      39                 :          12 :   if (module.get_visibility ().is_public ())
      40                 :           6 :     ctx.insert_globbed (module.get_name (), module.get_node_id (),
      41                 :             :                         Namespace::Types);
      42                 :          12 : }
      43                 :             : 
      44                 :             : void
      45                 :           0 : GlobbingVisitor::visit (AST::MacroRulesDefinition &macro)
      46                 :             : {
      47                 :           0 :   if (macro.get_visibility ().is_public ())
      48                 :           0 :     ctx.insert_globbed (macro.get_rule_name (), macro.get_node_id (),
      49                 :             :                         Namespace::Macros);
      50                 :           0 : }
      51                 :             : 
      52                 :             : void
      53                 :          20 : GlobbingVisitor::visit (AST::Function &function)
      54                 :             : {
      55                 :          20 :   if (function.get_visibility ().is_public ())
      56                 :          30 :     ctx.insert_globbed (function.get_function_name (), function.get_node_id (),
      57                 :             :                         Namespace::Values);
      58                 :          20 : }
      59                 :             : 
      60                 :             : void
      61                 :           0 : GlobbingVisitor::visit (AST::StaticItem &static_item)
      62                 :             : {
      63                 :           0 :   if (static_item.get_visibility ().is_public ())
      64                 :           0 :     ctx.insert_globbed (static_item.get_identifier (),
      65                 :             :                         static_item.get_node_id (), Namespace::Values);
      66                 :           0 : }
      67                 :             : 
      68                 :             : void
      69                 :           0 : GlobbingVisitor::visit (AST::StructStruct &struct_item)
      70                 :             : {
      71                 :           0 :   if (struct_item.get_visibility ().is_public ())
      72                 :             :     {
      73                 :           0 :       ctx.insert_globbed (struct_item.get_identifier (),
      74                 :             :                           struct_item.get_node_id (), Namespace::Types);
      75                 :           0 :       if (struct_item.is_unit_struct ())
      76                 :           0 :         ctx.insert_globbed (struct_item.get_identifier (),
      77                 :             :                             struct_item.get_node_id (), Namespace::Values);
      78                 :             :     }
      79                 :           0 : }
      80                 :             : 
      81                 :             : void
      82                 :           0 : GlobbingVisitor::visit (AST::TupleStruct &tuple_struct)
      83                 :             : {
      84                 :           0 :   if (tuple_struct.get_visibility ().is_public ())
      85                 :             :     {
      86                 :           0 :       ctx.insert_globbed (tuple_struct.get_identifier (),
      87                 :             :                           tuple_struct.get_node_id (), Namespace::Types);
      88                 :             : 
      89                 :           0 :       ctx.insert_globbed (tuple_struct.get_identifier (),
      90                 :             :                           tuple_struct.get_node_id (), Namespace::Values);
      91                 :             :     }
      92                 :           0 : }
      93                 :             : 
      94                 :             : void
      95                 :           0 : GlobbingVisitor::visit (AST::Enum &enum_item)
      96                 :             : {
      97                 :           0 :   if (enum_item.get_visibility ().is_public ())
      98                 :           0 :     ctx.insert_globbed (enum_item.get_identifier (), enum_item.get_node_id (),
      99                 :             :                         Namespace::Types);
     100                 :           0 : }
     101                 :             : 
     102                 :             : void
     103                 :           0 : GlobbingVisitor::visit (AST::Union &union_item)
     104                 :             : {
     105                 :           0 :   if (union_item.get_visibility ().is_public ())
     106                 :           0 :     ctx.insert_globbed (union_item.get_identifier (), union_item.get_node_id (),
     107                 :             :                         Namespace::Values);
     108                 :           0 : }
     109                 :             : 
     110                 :             : void
     111                 :           0 : GlobbingVisitor::visit (AST::ConstantItem &const_item)
     112                 :             : {
     113                 :           0 :   if (const_item.get_visibility ().is_public ())
     114                 :           0 :     ctx.insert_globbed (const_item.get_identifier (), const_item.get_node_id (),
     115                 :             :                         Namespace::Values);
     116                 :           0 : }
     117                 :             : 
     118                 :             : void
     119                 :           0 : GlobbingVisitor::visit (AST::ExternCrate &crate)
     120                 :           0 : {}
     121                 :             : 
     122                 :             : void
     123                 :           0 : GlobbingVisitor::visit (AST::UseDeclaration &use)
     124                 :             : {
     125                 :             :   // Handle cycles ?
     126                 :           0 : }
     127                 :             : 
     128                 :             : } // namespace Resolver2_0
     129                 :             : } // 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.