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 % 16 16
Test Date: 2024-04-13 14:00:49 Functions: 100.0 % 1 1
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-privacy-check.h"
      20                 :             : #include "rust-reachability.h"
      21                 :             : #include "rust-hir-type-check.h"
      22                 :             : #include "rust-hir-map.h"
      23                 :             : #include "rust-name-resolver.h"
      24                 :             : #include "rust-visibility-resolver.h"
      25                 :             : #include "rust-pub-restricted-visitor.h"
      26                 :             : #include "rust-privacy-reporter.h"
      27                 :             : 
      28                 :             : extern bool
      29                 :             : saw_errors (void);
      30                 :             : 
      31                 :             : namespace Rust {
      32                 :             : namespace Privacy {
      33                 :             : 
      34                 :             : void
      35                 :        3348 : Resolver::resolve (HIR::Crate &crate)
      36                 :             : {
      37                 :        3348 :   PrivacyContext ctx;
      38                 :        3348 :   auto mappings = Analysis::Mappings::get ();
      39                 :        3348 :   auto resolver = Rust::Resolver::Resolver::get ();
      40                 :        3348 :   auto ty_ctx = ::Rust::Resolver::TypeCheckContext::get ();
      41                 :             : 
      42                 :        3348 :   VisibilityResolver (*mappings, *resolver).go (crate);
      43                 :        3348 :   PubRestrictedVisitor (*mappings).go (crate);
      44                 :        3348 :   PrivacyReporter (*mappings, *resolver, *ty_ctx).go (crate);
      45                 :             : 
      46                 :        3348 :   auto visitor = ReachabilityVisitor (ctx, *ty_ctx);
      47                 :             : 
      48                 :       16202 :   for (auto &item : crate.get_items ())
      49                 :             :     {
      50                 :       12854 :       if (item->get_hir_kind () == HIR::Node::VIS_ITEM)
      51                 :             :         {
      52                 :       12854 :           auto vis_item = static_cast<HIR::VisItem *> (item.get ());
      53                 :       12854 :           vis_item->accept_vis (visitor);
      54                 :             :         }
      55                 :             :     }
      56                 :             : 
      57                 :        3348 :   if (saw_errors ())
      58                 :          10 :     return;
      59                 :        3348 : }
      60                 :             : } // namespace Privacy
      61                 :             : } // 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.