LCOV - code coverage report
Current view: top level - gcc/rust/checks/errors/privacy - rust-privacy-check.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 100.0 % 17 17
Test Date: 2026-02-28 14:20:25 Functions: 100.0 % 1 1
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-privacy-check.h"
      20              : #include "rust-reachability.h"
      21              : #include "rust-hir-type-check.h"
      22              : #include "rust-hir-map.h"
      23              : #include "rust-immutable-name-resolution-context.h"
      24              : #include "rust-visibility-resolver.h"
      25              : #include "rust-pub-restricted-visitor.h"
      26              : #include "rust-privacy-reporter.h"
      27              : 
      28              : extern bool saw_errors (void);
      29              : 
      30              : namespace Rust {
      31              : namespace Privacy {
      32              : 
      33              : void
      34         4121 : Resolver::resolve (HIR::Crate &crate)
      35              : {
      36         4121 :   PrivacyContext ctx;
      37         4121 :   auto &mappings = Analysis::Mappings::get ();
      38         4121 :   auto &resolver
      39         4121 :     = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
      40         4121 :   auto ty_ctx = ::Rust::Resolver::TypeCheckContext::get ();
      41              : 
      42         4121 :   VisibilityResolver (mappings, resolver).go (crate);
      43         4121 :   PubRestrictedVisitor (mappings).go (crate);
      44         4121 :   PrivacyReporter (mappings, resolver, *ty_ctx).go (crate);
      45              : 
      46         4121 :   auto visitor = ReachabilityVisitor (ctx, *ty_ctx);
      47              : 
      48        21141 :   for (auto &item : crate.get_items ())
      49              :     {
      50        17020 :       if (item->get_hir_kind () == HIR::Node::VIS_ITEM)
      51              :         {
      52        17020 :           auto vis_item = static_cast<HIR::VisItem *> (item.get ());
      53        17020 :           vis_item->accept_vis (visitor);
      54              :         }
      55              :     }
      56              : 
      57         4121 :   if (saw_errors ())
      58           10 :     return;
      59         4121 : }
      60              : } // namespace Privacy
      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.